Background
Many projects have default gadgets enabled. In some cases this can more than double the amount of JavaScript we ship to end users, which means more code to load and a more sluggish experience and potentially poorer SEO. For example on Italian Wikisource, without community maintained code/gadgets 315kb of assets is transferred for anonymous users on the desktop. However with gadgets 728kb of assets are transferred - which accounts for a 131% increase.
User story
As a sysop who knows nothing about performance, I don't want to slow down my wiki project with bad decisions around default gadgets / code and know how to improve things for my users.
Notes
One possible solution might be T360234
It seems helpful to focus on the extreme cases for now and work with communities to understand how their default gadgets can be optimized.
The following projects which have the highest increases are as follows (with highest at top and lowest at bottom):
- it.wikisource (131% increase)
- ru.wikivoyage
- fa.wikivoyage
- zh.wiktionary
- bn.wikisource
- vi.wikivoyage
- shn.wikivoyage
- it.wikivoyage
- en.wikivoyage
- vec.wiktionary
- en.wiktionary
- shn.wiktionary
- vi.wikipedia
- fa.wikibooks
- fr.wikivoyage
- fa.wikinews
- commons.wikimedia
- hy.wikipedia
- pl.wiktionary
- fr.wiktionary
- pl.wikipedia
- ru.wikipedia
- he.wikivoyage
- vi.wiktionary
- fa.wikiquote
- sv.wiktionary
- bn.wikivoyage
- bcl.wiktionary
- zh.wikivoyage
- pa.wikisource
- pa.wikisource
- tr.wiktionary
- sv.wikipedia
- ku.wiktionary
- th.wiktionary
- meta.wikimedia
- he.wikipedia (58% increase)
(For contrast enwiki has less than a 1% increase when community gadget/site scripts are shipped)
Common strategies that can be employed by communities to reduce payload:
- Get rid of old stuff that is no longer needed.
- Convert gadgets that use CSS that affects the content (like ambox and hatnotes) to TemplateStyles
- Is the gadget actually useful to anonymous users? Prefer |default|rights=minoredit (or purge or autoconfirmed) over |default to filter it out for anonymous users
- Is the gadget used only on the edit or history page ? use |actions=edit or actions=history in the definition
- Split gadgets that are required only in certain conditions into two
- First gadget checks the condition and then uses mw.loader.load( ''ext.gadget.GadgetName' ); to load more code
- Second gadget has the majority of the code, is not marked with |default, but with |hidden