Hi physikerwelt, you're correct, the overhead is a very small hash table entry for each module in the ResourceLoader registry—but this gets sent on every pageview. It's something like 12 bytes. See https://phabricator.wikimedia.org/T202154 and https://www.mediawiki.org/wiki/Wikimedia_Performance_Team/Page_load_performa... for more background.
These small entries add up quickly, as you can imagine!
The one situation where you would *not* want to merge modules is if one module will be loaded very often, and the second module is rarely needed. What you describe sounds like it might be one of these cases, so you'll have to estimate how much average overhead the merged module will cause, compared to the overhead of an additional module entry. Since there are a huge number of pageviews, it's usually a net benefit to coalesce ResourceLoader modules together even when they're used in slightly different workflows.
Sorry for the inconvenience of having to make this micro-optimization.
Regards, Adam W.
On 12/4/20 9:17 AM, Physikerwelt wrote:
Dear all,
I am trying to understand the performance impact of adding new ResourceLoader modules. I am currently stuck in the code review of
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Math/+/638094
as I am not convinced that it is a good idea to bundle an OOUI widget module and a special page js snippet into one module. One thing is a general-purpose control that is planned to be used in other contexts whereas the other is a very specific js code only executed on one particular special page. However, since this seems to be the critical point in the code review, I would like to better understand the impact of the additional resource module call.
I was looking at https://www.mediawiki.org/wiki/File:ResourceLoader_Client_lifecycle_2020.png and according to that overview, an additional module is just one entry in the module registry. I was hoping that minifying and caching is something the ResourceLoader would take care of. Any help would be appreciated.
Thank you physikerwelt
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l