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?
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.
I'm seeing 12
UPDATE exp_snippetsstatements 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. Jun 27, 2015 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.– LowJun 28, 2015 at 10:16