Currently anyone with the correct rights can edit [[MediaWiki:Gadgets-definition]] to turn gadgets on for anonymous users. Left unchecked this has led to some performance problems and potential SEO (related to slow loading) on many of our smaller sites leading to T340705.
We should be doing more to guide site admins on when they are introducing performance/SEO problems to the site.
In MediaWiki we've been investing a lot of effort in limiting the amount of CSS and JS we ship to our end users, but any improvements here are meaningless if the same is not happening within gadgets.
I think we should enforce a performance budget for all gadgets that have been marked as "default".
To do this we need
- Some way to calculate the amount of Kb of default gadgets are shipped to anonymous users
- A number that represents an upper bound for this code.
Future usages
Once we have such a number this could then be checked and either:
- Printed on the MEdiaWiki:Gadget-definitions page itself as a warning box (With guidelines of what is a high amount of code and small)
- Used to send Echo notifications to site admins when
- Disable all (or some of the) default gadgets when the "budget" has been surpassed.
- If it's possible to check this quickly on edit, we might refuse to allow edits to the page that introduce gadgets that exceed performance budget.