Page MenuHomePhabricator

ExternalGuidance: Reduce number of registered modules
Closed, ResolvedPublic

Description

I forgot about this during the performance review (sorry), but the extension currently registers quite a lot of modules, for all users on every page load:

  1. mw.externalguidance.init
  2. mw.externalguidance
  3. mw.externalguidance.icons
  4. mw.externalguidance.simulate
  5. mw.externalguidance.sitemapper
  6. mw.externalguidance.special
  7. mw.externalguidance.createpage

From a quick look at how they're used, I think the following there bundles might work:

  1. Loaded directly on all page views globally – mw.externalguidance.init (as minimal as possible, just a few conditions to load things if and when needed).
  2. Lazy loaded from page views when needed, by init: mw.externalguidance.
  3. Loaded directly onto the special page only: mw.externalguidance.special

In addition to these three entry points, there'd be 4) mw.externalguidance.icons which needs to exist as separate module for technical reasons. The rest seems small enough that it'd be beneficial to distribute them together rather than separate. The reason being that every module you register comes at a cost through the startup module – T202154 / https://www.mediawiki.org/wiki/Wikimedia_Performance_Team/Page_load_performance#Size_of_scripts.

Event Timeline

Krinkle created this task.Feb 12 2019, 6:45 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 12 2019, 6:45 PM
santhosh claimed this task.Feb 13 2019, 6:41 AM
santhosh triaged this task as Medium priority.
santhosh moved this task from Backlog to In Progress on the ExternalGuidance board.

Change 490314 had a related patch set uploaded (by Santhosh; owner: Santhosh):
[mediawiki/extensions/ExternalGuidance@master] Reduce number of registered modules, Organise module files by module directory

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

Change 490314 merged by jenkins-bot:
[mediawiki/extensions/ExternalGuidance@master] Reduce number of registered modules, Organise module files by module directory

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

santhosh moved this task from In Review to Done on the ExternalGuidance board.Feb 15 2019, 9:45 AM
Krinkle closed this task as Resolved.Feb 15 2019, 6:56 PM
Krinkle removed a project: Patch-For-Review.

Awesome. Thanks for completing that so quickly!