Page MenuHomePhabricator

Specify which Codex components we use for the app, so we get a custom build rather than the whole library
Closed, ResolvedPublic

Description

We currently rely on the full Codex library module for the main WikiLambda app, which can be quite a bit of dead-weight code we don't use (and more so each month as they add new features that we're not yet using). For the global language selector, we already rely on a slim version

  • Audit all our Codex components and determine which we're using.
  • Replace the dependency in extension.json for the app with a manifest, like we already do for the global language selector.
  • Change our jest test code to load specific components, not the whole library (so we notice in CI if we're using a component we don't rely on in the manifest).
  • Check that this actually reduces bytes sent and the additional CPU load / cache misses are reasonable.

Event Timeline

Jdforrester-WMF moved this task from To Triage to Backlog on the Abstract Wikipedia team board.
DSmit-WMF changed the task status from Open to In Progress.Jan 28 2025, 11:03 AM
DSmit-WMF claimed this task.

Analyzed my Patch: from 462kb to 450kb JS in the browser

Change #1114678 had a related patch set uploaded (by Daphne Smit; author: Daphne Smit):

[mediawiki/extensions/WikiLambda@master] ResourceLoader: load only Codex components we use

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

Change #1114678 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] ResourceLoader: load only Codex components we use

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

Did we see a reduction/increase in performance metrics with this change?

OK, have checked locally, and this looks like a modest but clear win:

ModuleSize beforeSize afterChange
ext.wikilambda.app1.0 MiB / 1,077,4741.3 MiB / 1,343,690+ 0.3 MiB / + 266216
vue156.3 KiB / 160,064156.3 KiB / 160,064No change
@wikimedia/codex153.3 KiB / 156,950Eliminated
codex-styles139.0 KiB / 142,383Eliminated
ext.wikilambda.languageselector107.1 KiB / 109,717107.2 KiB / 109,723+ 0.1 KiB / + 6
Total1.6 MiB / 1,696,5681.5 MiB / 1,574,777- 0.1 MiB / - 121,791