Page MenuHomePhabricator

review default gadgets on wikidata.org for performance improvements
Closed, ResolvedPublic

Description


Version: unspecified
Severity: normal
Whiteboard: backlog
URL: https://www.wikidata.org/wiki/Special:Gadgets

Details

Reference
bz60536

Event Timeline

There are a few gadgets enabled by default on Wikidata.org. They should be reviewed for possible performance improvements.

I did a code review of all gadgets that are enabled by default.

[[d:MediaWiki:Gadget-RfDHelper.js]] is executed when viewing [[d:Wikidata:Requests for deletions]] only.

[[d:MediaWiki:Gadget-CommonsMedia.js]] does not do anything on Item pages since media files are already linked to Commons.

[[d:MediaWiki:Gadget-imagelinks.js]] is very well written and very fast.

[[d:MediaWiki:Gadget-Search.js]] is a bit "hacky" but very simple and very fast.

[[d:MediaWiki:Gadget-AuthorityControl.js]] does have a bottleneck (nested loops). On very big Item pages it takes about half a second. I made a change request on the talk page.

(In reply to comment #3)

[[d:MediaWiki:Gadget-RfDHelper.js]] is executed when viewing
[[d:Wikidata:Requests for deletions]] only.

I only thought about this when you said that, but the main portion of the script is only executed on [[d:WD:RFD]], however the gadget has a dependency upon 'mediawiki.language', which is loaded on every page even though it isn't used. We can fix that by wrapping the script in a mw.loader.using call, which I'll do today.

(In reply to Kunal Mehta (Legoktm) from comment #4)

I left you a message at [[d:MediaWiki talk:Gadget-RfDHelper.js]].

The bottleneck I found at [[d:MediaWiki:Gadget-AuthorityControl.js]] got fixed. Since there are more nested loops in that script I did some more benchmarking. But all these loops are short (in most cases only 1 iteration). Now the bottleneck is when the anchor elements are added and the page is re-rendered. But this can't be avoided obviously.

I will close this as fixed for now. Please re-open if I should look into other gadgets or new versions of existing ones.