ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Global variable and embed templates performance

July 08, 2008 4:46am

Subscribe [3]
  • #1 / Jul 08, 2008 4:46am

    evasion

    58 posts

    Hello there,

    Some simple question : are global variables faster to parse than embed templates ? Does embed it require less query than embed templates ?

    I’ve tested some different method, and it seems that global variable require one less query. Could someone confirm this ?

    Thanks in advance for your help 😊

  • #2 / Jul 08, 2008 5:23am

    Ingmar

    29245 posts

    Yes, variables should be slightly faster than embedded templates, but in practical terms it will most likely not matter.

  • #3 / Jul 08, 2008 5:28am

    evasion

    58 posts

    10 global variable is 10 less queries than 10 embed templates. It should increase speed, no ?

  • #4 / Jul 08, 2008 5:30am

    Ingmar

    29245 posts

    Well, 10 embedded template is a bit much perhaps. I thought we were talking about a header and a footer, or something along these lines. Even then, template caching will get you a long way.

  • #5 / Jul 08, 2008 5:34am

    evasion

    58 posts

    I also do template caching, query caching and run an PHP accelerator, but I try to optimize it as much as possible. Thanks for your reply, I think we could close this thread.

    Perhaps adding this information in the wiki may be useful for other users.

  • #6 / Jul 08, 2008 5:40am

    Ingmar

    29245 posts

    We only close “genuine” tech support threads, so, no harm in leaving this one open 😊 As to the wiki: it’s a community effort, so everyone is very welcome to contribute there.

  • #7 / Jul 08, 2008 5:43am

    evasion

    58 posts

    Ok thanks 😊

  • #8 / Jul 08, 2008 5:44am

    Danny T.

    426 posts

    Ingmar,

    Perhaps you can elaborate on this for me on what evasion is comparing. I understand global variables, but is he thinking it in the sense of inserting a large amount of HTML and using the variable directly in templates rather than actually creating a template? Doesn’t going by this method create parsing issues one might experience?

  • #9 / Jul 08, 2008 5:48am

    evasion

    58 posts

    Mr_dimsum : in fact I have multiple portion of HTML that is repeated in various templates of my site : advertising script, google analytics code, etc.

    This HTML may changer later, so it’s easier to maintain if I only need to change it once.

    Does it answer to your question ?

  • #10 / Jul 08, 2008 5:51am

    Danny T.

    426 posts

    That’s a good enough answer I suppose. I obviously don’t know enough on the subject, but I think the performance different is probably negligible and might not be worth the time to look into. Than again, if it’s very important for you, than I’m certainly glad you have determined what performs better for you mate. I’m always looking at optimizations as well, but will probably just stick to templating for formality and tidiness sake.

    By the way, that’s a great portfolio. Congratulations for making it into Digital Arts! 😊

  • #11 / Jul 08, 2008 5:54am

    evasion

    58 posts

    Thanks a lot 😊

    I try to optimize it as much as possible because it will be used on some *big* site (ie: 50k visitors a day).

  • #12 / Jul 08, 2008 6:05am

    Ingmar

    29245 posts

    I understand global variables, but is he thinking it in the sense of inserting a large amount of HTML and using the variable directly in templates rather than actually creating a template? Doesn’t going by this method create parsing issues one might experience?

    I suppose that’s what he does, yes. I, too, was thinking of variables as little snippets of text, but you can insert entire chunks of HTML code that way. You might want to read Derek’s “Behind the curtain” series for a closer look (among other things).

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases