Page MenuHomePhabricator

Reduce number of distinct module bundles registered by TimedMediaHandler
Closed, ResolvedPublic

Description

For context and rationale, see:

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

Details

ProjectBranchLines +/-Subject
mediawiki/extensions/TimedMediaHandlermaster+0 -29
mediawiki/extensions/TimedMediaHandlermaster+6 -11
mediawiki/extensions/TimedMediaHandlermaster+7 -11
mediawiki/extensions/TimedMediaHandlermaster+10 -420
mediawiki/extensions/TimedMediaHandlermaster+5 -6
mediawiki/extensions/TimedMediaHandlermaster+5 -8
mediawiki/extensions/TimedMediaHandlermaster+3 -9
mediawiki/extensions/TimedMediaHandlermaster+1 -4
mediawiki/extensions/TimedMediaHandlermaster+12 -53
mediawiki/extensions/TimedMediaHandlermaster+10 -1
mediawiki/extensions/TimedMediaHandlermaster+3 -13
mediawiki/extensions/TimedMediaHandlermaster+7 -13
mediawiki/extensions/TimedMediaHandlermaster+6 -12
mediawiki/extensions/TimedMediaHandlermaster+5 -10
mediawiki/extensions/TimedMediaHandlermaster+4 -5
mediawiki/extensions/TimedMediaHandlermaster+0 -1 K
Show related patches Customize query in gerrit

Event Timeline

Change 681509 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/extensions/TimedMediaHandler@master] mwembed: Remove unused "iScroll" module

https://gerrit.wikimedia.org/r/681509

Change 681510 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/extensions/TimedMediaHandler@master] mwembed: Merge "mw.Api" into "mw.MediaWikiPlayerSupport" bundle

https://gerrit.wikimedia.org/r/681510

Change 681511 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/extensions/TimedMediaHandler@master] ext.tmh.player.dialog: Move player inline styles into this bundle

https://gerrit.wikimedia.org/r/681511

Change 681512 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/extensions/TimedMediaHandler@master] mw.MwEmbedSupport: Bundle Spinner and jquery.loadingSpinner

https://gerrit.wikimedia.org/r/681512

I've shaken out about 5 modules to start with (based on a quick script that looks for modules in extension.json with either 0 or 1 dependency to it; and then confirming with git-grep that it has no loading logic in PHP or JS, and also via Codesearch no references to it from anywhere.

These 5 would be enough to get our registry size back to at least where we were in January which would be nice. TMH didn't regress this quarter, but it's overdue to slim down a bit, and it was the easy target to free up some budget.

Change 681509 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] mwembed: Remove unused "iScroll" module

https://gerrit.wikimedia.org/r/681509

Change 681510 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] mwembed: Merge "mw.Api" into "mw.MediaWikiPlayerSupport" bundle

https://gerrit.wikimedia.org/r/681510

Change 681511 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] ext.tmh.player.dialog: Move player inline styles into this bundle

https://gerrit.wikimedia.org/r/681511

Change 681512 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] mw.MwEmbedSupport: Bundle Spinner and jquery.loadingSpinner

https://gerrit.wikimedia.org/r/681512

Change 683985 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/extensions/TimedMediaHandler@master] Bundle videojs-resolution-switcher with ext.tmh.player.inline

https://gerrit.wikimedia.org/r/683985

Change 683985 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] Bundle videojs-resolution-switcher with ext.tmh.player.inline

https://gerrit.wikimedia.org/r/683985

Change 699461 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/extensions/TimedMediaHandler@master] Bundle `mw-info-button` with ext.tmh.player.inline

https://gerrit.wikimedia.org/r/699461

Change 699461 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] Bundle `mw-info-button` with ext.tmh.player.inline

https://gerrit.wikimedia.org/r/699461

Change 722898 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/extensions/TimedMediaHandler@master] Merge mw.PopUpMediaTransform.styles module into only user

https://gerrit.wikimedia.org/r/722898

Change 722899 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/extensions/TimedMediaHandler@master] Merge 10 dependencies into mw.EmbedPlayer module

https://gerrit.wikimedia.org/r/722899

For later, also mergable:
mw.MwEmbedSupport:

  • jquery.triggerQueueCallback
  • jquery.mwEmbedUtil (also loaded in one place alongside mw.MwEmbedSupport)

mw.TextSource:

  • mw.ajaxProxy

mw.MediaWikiPlayer.loader

  • mw.EmbedPlayer.loader
  • mw.TimedText.loader

Change 722900 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/extensions/TimedMediaHandler@master] Grep comments for dynamically created RL module names loading

https://gerrit.wikimedia.org/r/722900

Change 722900 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] Grep comments for dynamically created RL module names loading

https://gerrit.wikimedia.org/r/722900

Change 722899 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] Merge 10 dependencies into mw.EmbedPlayer module

https://gerrit.wikimedia.org/r/722899

Change 722898 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] Merge mw.PopUpMediaTransform.styles module into only user

https://gerrit.wikimedia.org/r/722898

Change 723195 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/extensions/TimedMediaHandler@master] Drop unused mw.EmbedPlayerVlc and mw.EmbedPlayerGeneric

https://gerrit.wikimedia.org/r/723195

Change 723199 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/extensions/TimedMediaHandler@master] Merge two dependencies into `mw.MwEmbedSupport` module

https://gerrit.wikimedia.org/r/723199

Change 723201 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/extensions/TimedMediaHandler@master] Merge mw.MwEmbedSupport.style module into only user

https://gerrit.wikimedia.org/r/723201

Change 723635 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/extensions/TimedMediaHandler@master] Merge mw.ajaxProxy into mw.TextSource

https://gerrit.wikimedia.org/r/723635

Change 723199 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] Merge two dependencies into `mw.MwEmbedSupport` module

https://gerrit.wikimedia.org/r/723199

Change 723201 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] Merge mw.MwEmbedSupport.style module into only user

https://gerrit.wikimedia.org/r/723201

Change 723635 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] Merge mw.ajaxProxy into mw.TextSource

https://gerrit.wikimedia.org/r/723635

Change 723195 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] Drop unused mw.EmbedPlayerVlc and mw.EmbedPlayerGeneric

https://gerrit.wikimedia.org/r/723195

Change 723638 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/extensions/TimedMediaHandler@master] Merge dependencies into mw.MediaWikiPlayer.loader module

https://gerrit.wikimedia.org/r/723638

Change 723639 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/extensions/TimedMediaHandler@master] Merge mw.TextSource module into mw.TimedText

https://gerrit.wikimedia.org/r/723639

Change 723638 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] Merge dependencies into mw.MediaWikiPlayer.loader module

https://gerrit.wikimedia.org/r/723638

Change 723639 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] Merge mw.TextSource module into mw.TimedText

https://gerrit.wikimedia.org/r/723639

Now down to 27 modules, and switching the video player should help with a bunch more

Change 801191 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/extensions/TimedMediaHandler@master] Remove unused style module `ext.tmh.thumbnail.styles`

https://gerrit.wikimedia.org/r/801191

Change 801191 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] Remove unused style module `ext.tmh.thumbnail.styles`

https://gerrit.wikimedia.org/r/801191

Jdforrester-WMF updated the task description. (Show Details)