On 31/01/12 04:24, Roan Kattouw wrote:
On Mon, Jan 30, 2012 at 3:11 PM, Alex Brollo alex.brollo@gmail.com wrote:
I'm using more and more #switch into templates, it's surprising how many issues it can solve, and how much large arrays it can manage. My questions are:
- Is there a reasonable upper limit for the number of #switch options?
- Is there a difference in server load between a long list of #switch
options and a "tree" of options t.i. something as a nested #switch? 3. Is there any drawback into a large use of #swtch-based templates?
I can at least tell you that the answer to #1 is probably no, and the answer to #3 is yes. There were some server issues last week that were blamed on ocwiki's use of templates with #switch statements with thousands of options. For instance, https://oc.wikipedia.org/w/index.php?title=Mod%C3%A8l:Altmejcom&action=e... has 36,611 cases, because it's essentially used as a database. That's the kind of thing that takes forever to parse.
Actually it's relatively fast to parse, but it uses hundreds of megabytes of unaccounted memory and can even send the servers into swap.
I'm considering introducing a limit on #switch cases of 2000 or so per article, to address this issue. No doubt many templates will break, but it's important to protect our servers, and we've always discouraged this kind of #switch application.
-- Tim Starling