Page MenuHomePhabricator

Avoid invoking Parser in WikibaseClient ResourceLoaderJqueryMsgModuleMagicWords hook
Closed, ResolvedPublic


When generating the startup response for a wiki, ResourceLoader needs to compute the content and version of the mediawiki.jqueryMsg module. This currently involves invoking the Parser.

The Parser adds performance overhead that I believe may've been unintentional.

It is coming from WikibaseClient's ResourceLoaderJqueryMsgModuleMagicWords hook.

Flame graph:

Screen Shot 2018-08-16 at 21.20.03.png (1×2 px, 360 KB)


# function doResourceLoaderJqueryMsgModuleMagicWords {
$magicWords['WBREPONAME'] = $this->getRepoName( $lang );

# function getRepoName {
$message = new Message( $repoSiteName );
$message->inLanguage( $lang );
if ( $message->exists() ) {
	return $message->parse();

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I'd recommend considering Message::text() instead of Message::parse(). This would disallow templates and parser functions, which aren't currently used in those messages.

Addshore triaged this task as Medium priority.Aug 17 2018, 3:05 PM

Change 453410 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/extensions/Wikibase@master] Don't parse i18n message for WBREPONAME magic word

Change 453410 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Don't parse i18n message for WBREPONAME magic word

Addshore moved this task from Active 🚁 to Closing ✔️ on the User-Addshore board.
Addshore moved this task from incoming to in progress on the Wikidata board.
Addshore moved this task from Peer Review to Done on the Wikidata-Campsite board.