For context and rationale, see:
- T233675: Audit startup JavaScript payload (Aug 2018—Sept 2019)
- T202154: Audit modules 2018: Reduce registry overhead
This extension has long been one of the largest extensions in terms of its share in the startup.js payload for all page views in production. From Grafana: Startup manifest size it currently registers 54 module bundles which transfer about 2KB on every page view during the critical path just to communicate the client about their existence.
I've thus far restisted the temptation to reduce this proactively knowing that a lot of this will be cut away once the transition from Kaltura to video.js completes (ref T100106).
However, I think there's a number of modules here even ignoring the legacy Kaltura parts that can potentially be reduced, and we may be able to do some very quick/easy consolidation or removal of unused modules besides that as well.
2021 progress:
- https://gerrit.wikimedia.org/r/722899 : -10 modules by merging dependencies into mw.EmbedPlayer (removed mediawiki.absoluteUrl, mediawiki.client, fullScreenApi, jquery.debouncedresize, jquery.embedMenu, mw.EmbedTypes, mw.MediaElement, mw.MediaSource, mw.MediaPlayers, mw.MediaPlayer)
- https://gerrit.wikimedia.org/r/722898 : -1 module by merging mw.PopUpMediaTransform.styles into mw.PopUpMediaTransform
- https://gerrit.wikimedia.org/r/723195 : -2 modules by removing unused mw.EmbedPlayerVlc and mw.EmbedPlayerGeneric
- https://gerrit.wikimedia.org/r/723199 : -2 modules by merging jquery.triggerQueueCallback and jquery.mwEmbedUtil into mw.MwEmbedSupport
- https://gerrit.wikimedia.org/r/723201 : -1 module by merging mw.MwEmbedSupport.style into mw.MwEmbedSupport
- https://gerrit.wikimedia.org/r/723635: -1 module by merging mw.ajaxProxy into mw.TextSource
- https://gerrit.wikimedia.org/r/723638 : -2 modules by merging mw.EmbedPlayer.loader and mw.TimedText.loader into mw.MediaWikiPlayer.loader
- https://gerrit.wikimedia.org/r/723639: -1 module by merging mw.TextSource into mw.TimedText
- MABYE: mediawiki.UtilitiesTime is used by mw.EmbedPlayer and mw.TextSource, after the step above will be used by mw.EmbedPlayer and mw.TimedText, but mw.TimedText also depends on mw.EmbedPlayer, so mediawiki.UtilitiesTime can be merged into mw.EmbedPlayer ?
- Consider merging some of the smaller mw.EmbedPlayer* modules. Sizes (library-lines): Kplayer-496, IEWebMPrompt-46 (plus 18 lines of styles), ImageOverlay-316, OgvJs-266 (has fairly small dependencies), VLCApp-101 (mediawiki.Uri dependency). Or maybe merge them all into a single module? It means some extra code would be loaded when not needed, but we could use package files to not run it when not needed, or just let it all run because it shouldn't conflict with others