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.

exp:entries open/close performance

January 06, 2008 7:51pm

Subscribe [0]
  • #1 / Jan 06, 2008 7:51pm

    Saxi

    108 posts

    I have been keeping the exp:entries open for most of a page because I figured it would be better performance than opening it on different sections of the page and closing it.

    But I have seen some samples that would open and close the exp:entries for example to display the side bar, then one for the content, and sometimes even again for another section of the template.  I have been opening it when it is first needed, and if there are multiple areas that require it (sidebar, left content, and maybe somewhere else on the page) keep it open, then close it when it is last required.

  • #2 / Jan 06, 2008 8:14pm

    mayest

    293 posts

    Excellent question, Saxi. I was just wondering about this myself. How much of a performance hit, if any, do you take every time you open an identical entries tag? I’m thinking that it might be virtually none because of the various caches.

  • #3 / Jan 06, 2008 8:21pm

    Saxi

    108 posts

    Excellent question, Saxi. I was just wondering about this myself. How much of a performance hit, if any, do you take every time you open an identical entries tag? I’m thinking that it might be virtually none because of the various caches.

    I think the caches will make a big difference, but in some caches it is not ideal to cache templates.  But more or less speaking of the 90% case when you do.

  • #4 / Jan 06, 2008 8:48pm

    Kyle Slattery

    109 posts

    Well, SQL queries can be cached, so theoretically, it should only be hitting the database once for the first query and then it will just grab from the cache after that.

  • #5 / Jan 07, 2008 1:17am

    Lisa Wess

    20502 posts

    If you keep the weblog entries tag open, then all your variables will be in the context of the weblog entries that.  That includes your otherwise standard global variables.  You can also create conflicts and confusion with other tags and nesting.  It is definitely best to close your weblog entries tag immediately when it is done being needed.

  • #6 / Jan 07, 2008 1:19am

    Saxi

    108 posts

    Is there any significant performance gain by not closing and re-opening if there are no global variables used or another tag?

  • #7 / Jan 07, 2008 1:21am

    Lisa Wess

    20502 posts

    You can see speed and memory used by going to Admin -> System Preferences -> Output and Debugging -> Template Debugging.

  • #8 / Jan 09, 2008 5:12am

    oldgoldblack

    113 posts

    Saxi, if you test a template both ways, I’d be interested to know if performance does vary at all. I would think any hit you take either way is negligible. But I don’t know much. It would be interesting.

    There’s always optimizing elsewhere, of course.

  • #9 / Jan 09, 2008 5:34am

    Daniel Walton

    553 posts

    If you had 20k of unnecessary html between the tags, that’s an extra 20k of characters, that, a) is needed in memory, at several stages of the script running. b) has to be waded through by the many variable replacement searchs (regex et al), and finally, c) is prone to induce html parse errors should you not define the tag correctly (repeating body tags etc) - not only this but it confuses the look of the templates should you need multiple entries tags in some and only one in others.

    Negligible, the changes are, until multiplied they are not.

  • #10 / Jan 09, 2008 5:57am

    oldgoldblack

    113 posts

    Ah, very interesting. Thanks Daniel. (Guess I showed myself to be one of those know-nothing designers, eh?)

    Point taken on (a) and (b), I understand EE’s algorithim a little better with that. As for (c), I know I’d get confusing code and errors galore, but sounds like saxi already leaves entries tags open for most of the page without trouble. That’s quite a feat of something.

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

ExpressionEngine News!

#eecms, #events, #releases