Page MenuHomePhabricator

PHP shims for JSON i18n files can register LocalisationCacheRecache handlers multiple times
Closed, ResolvedPublic

Description

From Adrian Lang's email to wikitech-l http://www.gossamer-threads.com/lists/wiki/wikitech/452196:

I recently investigated a performance issue with one of Wikibase's
test cases. The test in question performed a formatting task for all
known languages. While the first assertions ran as fast as expected,
they rapidly got slower until finally taking seconds per assertion. I
figured this was an actual performance bug (although hardly triggered
in production) and started profiling.

My findings, in short:

  • The shims for $wgExtensionMessagesFiles as generated by

maintenance/generateJsonI18n.php register a handler for the hook
LocalisationCacheRecache when included

  • For every new language loaded, all $wgExtensionMessagesFiles are

included by LocalisationCache::recache

  • Afterwards, LocalisationCache::recache runs the hook LocalisationCacheRecache

This leads to the obvious issue that there is a growing number of
registered handlers, which slows down the hook, which slows down the
test.

The shims should be fixed to avoid this.


Version: 1.23.0
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=63926

Details

Reference
bz63928

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:24 AM
bzimport set Reference to bz63928.
bzimport added a subscriber: Unknown Object (MLST).

Change 125706 had a related patch set uploaded by PleaseStand:
JSON i18n shim: Only register LocalisationCacheRecache handler once

https://gerrit.wikimedia.org/r/125706

This needs to be backported to 1.23 when merged.

Until a backport is merged, ? is used.

Change 125706 merged by jenkins-bot:
JSON i18n shim: Only register LocalisationCacheRecache handler once

https://gerrit.wikimedia.org/r/125706

Change 127893 had a related patch set uploaded by Siebrand:
JSON i18n shim: Only register LocalisationCacheRecache handler once

https://gerrit.wikimedia.org/r/127893

Change 127893 merged by jenkins-bot:
JSON i18n shim: Only register LocalisationCacheRecache handler once

https://gerrit.wikimedia.org/r/127893