Page MenuHomePhabricator

Increase $wgExpensiveParserFunctionLimit to 500 on translatewiki.net
Open, MediumPublic

Description

As mentioned by Nike at https://translatewiki.net/wiki/Support#c-Nike-20241221155400-Stjn-20241221153500 current limit is 100 because that is the MediaWiki default. I propose increasing it to 500 (value on WMF websites) so that existence checks from https://translatewiki.net/wiki/Module:Msg templates can work normally on all pages. I’ve written the module to be as easy on the number of expensive functions as possible, these are just #ifexist checks that are unavoidable if we want to catch missing message keys in these templates.

Currently, https://translatewiki.net/wiki/Category:Pages_with_too_many_expensive_parser_function_calls has 819 pages because of the current usage limit.

Event Timeline

these are just #ifexist checks that are unavoidable if we want to catch missing message keys in these templates

Actually, thinking about it, they are avoidable: since you expand the message content anyway in most cases, you could use that expansion to determine whether the message exists, at least when the message content is indeed expanded. (This is not an argument against increasing the limit, just a tip on how to make the module less expensive.)

I think msgnw that’s currently used because it’s the best for escaping does not bode well with that, or I would’ve implemented it. Or maybe I didn’t because there are a number of empty messages that need to be checked. If it’s the latter, then yes, theoretically there could be fewer checks by only checking messages that are empty. I’ll look into that.

I adjusted specific https://translatewiki.net/wiki/Module:Msg use case to not use .exists check at all based on your suggestion. It results in a slightly lower performance but since otherwise it already matches what the module did, I guess there is no problem with it other than preprocessing two messages (English and user language) instead of one.