Forum:Is there an upper limit to how many bytes of code can be generated from template calls on the one page?

The symptom of this problem is that after some threshold is exceeded subsequent template calls do not expanded on the page. Instead the   wiki code is displayed. If the last template to expand calls other templates then the expansion may be only partial with the above symptom showing up part way through the expansion of that last template call.

After a little debug work with this demo template and this sandbox I can demonstrate that the number of ASCII characters in the template affects how many calls to that template are possible on the one page.
 * This is the case even if the ASCII characters are in commented-out blocks of code within an otherwise very small template.
 * It is also the case even if the characters are wrapped in noinclude../noinclude tags.


 * 1) Has anybody else noticed that templates cease to expand after too many have been used on a given page?
 * 2) What are the per page limits on template use? (I am guessing this is measured in kilobytes)
 * 3) How do I measure a page's current usage against this limit?

I may have figured out a a kind of "divide and conquer" workaround involving the use of template sub-pages to push any template usage documentation as well as frequently used modules of code. However, this workaround involves passing many more parameters to sub-pages than feels right so it looks like making the template very difficult to interpret and maintain.

Notwithstanding the above mentioned potential workaround, I'd first like to understand the fundamental limit that I am running into.


 * If you go snooping around the demo template link mentioned above then please review the edit history for my notes on which versions are problematic. The more recent ones are using the workaround so may not manifest the above symptom. Any version earlier than or including this one (Revision as of 00:56, 2008 October 31) will demonstrate the limitation.

najevi 01:01, 31 October 2008 (UTC)


 * There is a report of usage vs. limitations in the generated page source of each article page. For example, I got this from the source of http://rappelz.wikia.com/wiki/User:Najevi/sandbox5


 * Off-topic: As an aside, you can also find out whether or not the wiki you're on uses the new preprocessor as the report has different text based on which preprocessor is in use. - Adan Aileron (talk) 02:10, 31 October 2008 (UTC)


 * Thank you. I have now learned that the Rappelz Wiki is using the old pre-processor (this forum uses the new pre-processor). I was able to use the tool Special:ParserDiffTest on the sandbox demo page and found that the entire page was rendered successfully!


 * FYI: This article, Migration to the new preprocessor makes it very clear what that ParserDiffTest tool is to be used for. It also explains how to test which pre-processor your wiki is currently using.


 * najevi 06:09, 31 October 2008 (UTC)

Can the pre-expand size limit be increased from 2MB to say, 20MB ?
Thank you. I now see explicit comments like this one when I use, (Ctrl+U) View.Page Source, on the incomplete page:  < !-- WARNING: template omitted, pre-expand include size too large -- >  Sometimes you just need to be reminded where to look for clues! I expect I will remember that source in future.


 * So, 2MB seems to be the threshold. See also: wikipedia:Wikipedia:Template_limits although I have not yet found a wikia or wikimedia site-specific help/info page on this subject.

I can at least work on paring down my existing templates to squeeze to that space. I can easily remove code comments from my templates and relocate "noinclude"-ed Usage documentation to a sub-page. However, I don't think that is going to be enough to make a significant difference.

The beauty of conditional parser functions inside a template is that the post-expand size can be so small in a one-template-suits-many type of application. In the above case you set the post expand size is only 1% of the pre-expand size.


 * Is there any chance of having the pre-expand size increased?

It doesn't make sense for "comment"-ed blocks and "noinclude"-ed blocks to be counted in the pre-expand size. Am I alone in thinking this way? Mmmm, OK ... after reading this section even I can understand why it is this way.

najevi 05:01, 31 October 2008 (UTC)