1

I have a simple about page being rendered with the content of only one entry and some Low Variables bits. It's rather slow (3.8806 seconds according to the Output Profiler), and the Template Debugging shows that all possible snippets are being loaded 6 times in each page load. The only number I could correlate with that is the number of templates being rendered in the page (aside from the main page, there's embedded template partials for the header and footer, scripts, etc). Am I correct in assuming that all snippet content is being loaded for every time a template is loaded? Is there any way to make it not do that?

2

The snippets are not actually "loading" - they are simply bits of text being stored in memory (much like global variables). They aren't actually processed until they're called. So they're not an overhead problem.

You'll see these being "loaded" each time you run the template engine - which means the primary template, and then each embed.

| improve this answer | |
  • I'm seeing 12 UPDATE exp_snippets statements in the Output Profiler for the page, including for snippets that aren't being used at all on this page. I think you're correct in that the snippets are being loaded into memory only once when a page is visited, but it's also updating the snippets table--12 times, once for all snippets, including the ones not on the page. – huertanix Jun 27 '15 at 22:40
  • That sounds like the doing of an extension. Do you have an add-on installed that lets you save snippets as files? If so, disabling that will most likely get rid of those UPDATEs. – Low Jun 28 '15 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.