Jump to content

Topic on Project:Support desk

Node-count limit exceeded, can I get the value used for ParserFunctions comparisons back?

7
Alexis Jazz (talkcontribs)

For wikt:nl:Sjabloon:citeer (citation template) I'm running into node-count limit being exceeded with heavy use. This happens when the template is used 20-25 times, depending on circumstances. Actual speed is not the issue, page rendering takes about 6 seconds when using the template 20 times and I can probably get that number down. Ironically, in getting that number down, I'll probably only accumulate more nodes. Many of the nodes result from wikt:nl:Sjabloon:Wikipedia artikel which searches various lists of Wikipedia article names, to determine if a WP article exists for something. For example, requesting "Aladdin en de wonderlamp" in the category book titles returns w:nl:Aladdin en de wonderlamp (boek).

A major issue is that I often do something like "{{#if:{{something REALLY expensive}}|{{something REALLY expensive}}|another thing}} or {{#switch:{{something REALLY expensive}}|{{something ELSE, also REALLY expensive}}={{something REALLY expensive}}|{{something ELSE, also REALLY expensive}}}}. In both these cases, I'm running {{something REALLY expensive}} twice. I know I can solve this by creating a new template, but if I create a new template (and pass all the parameters to the new template) every single time I do this, I go nuts.

If only I could just get back that value. Side note: is it even possible to raise the node count limit on a wiki?

MarkAHershberger (talkcontribs)

I haven't looked closely at this, but it sounds like you may benefit from switching from Templates to Lua/Scribunto.

Have you tried that?

Alexis Jazz (talkcontribs)

@MarkAHershberger: I don't quite get Lua. So no.

I managed to reduce the node count. Unfortunately, this resulted in exceeding the expansion depth. Only on one page for now, but this means I'm right at the limit. So the "create new templates" trick doesn't work anymore.

MarkAHershberger (talkcontribs)

The WMF developed Scribunto because of the sorts of problems you're seeing. You will see more progress with a little investment in Lua than you will by trying to fix the template without it.

Other wikis have moved a lot of the functionality of their templates into Lua, so there is probably a lot of work you can just crib to your wiki. I'm not sure how Sjabloon:citeer differs from Template:cite (the documentation is certainly different) but it uses a few more bits from the Module: namespace, so maybe there is something you can use.

Alexis Jazz (talkcontribs)

@MarkAHershberger: wikt:nl:Sjabloon:citeer is not based on wikt:Template:cite (or anything else) and in many ways much more advanced. It automatically wikifies writers, book titles, movie titles, etc. It automatically makes the word the quote is used for bold. It doesn't require the user to add ref tags. And quite a few things more. So I can't borrow anything and I have no idea how or why Lua would even help here. Can it be used to create the thing I asked for? #if but getting the value back?

Jonathan3 (talkcontribs)
Alexis Jazz (talkcontribs)

@Jonathan3: that should work, but it's not installed by default. Not sure if that can be enabled on Mediawiki wikis.

Reply to "Node-count limit exceeded, can I get the value used for ParserFunctions comparisons back?"