Page MenuHomePhabricator

DiscussionTools loads 1.7MB of VisualEditor JS (350kB transfer) on mediawiki.org Main Page
Closed, ResolvedPublic

Description

  1. Logged-out or logged-in, Vector skin, run localStorage.clear() from console to ensure a clean slate, although it happens without it as well.
  2. https://www.mediawiki.org/wiki/MediaWiki?safemode=on

Screenshot 2023-05-05 at 01.11.45.png (2,113×1,555 px, 570 KB)

This includes the full editor code that normally loads only when you click Edit on an article, or Reply on a talk page. Including the ~200kB ext.visualEditor.core module.

The main problem is that MediaWiki as a software is hard to promise as performing well at scale when our main landing page loads 1.7MB of unused JavaScript.

I assume that the root cause here is the wider issue with wgExtraSignatureNamespaces and how DT lacks a more precise (yet sufficiently confident) signal for loading itself on wikis that have (some) discussion pages in the main space. In other words, this isn't representative of how MediaWiki or DiscussionTools affect Wikipedia or other "normal" wikis, because we happen to enable this on mediawiki.org in an unusual way.

Having said that, we probably shouldn't load the entirety of VE passively on real talk pages, either! But I suppose we can at least defer it to the point in the code where it has determined there are real comment threads on the page, with a working Reply link. In the case of the Main Page there are no comment threads, and when logged-out, also no permission to edit.

Event Timeline

Krinkle triaged this task as High priority.May 5 2023, 12:21 AM

Change 921660 had a related patch set uploaded (by DLynch; author: DLynch):

[mediawiki/extensions/DiscussionTools@master] Delay the load of VE modules until we're sure they're needed

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

That's the more aggressive version, loading the modules when a user actually interacts with a link, which might cause a user experience regression.

That's the more aggressive version, loading the modules when a user actually interacts with a link, which might cause a user experience regression.

+1. Let's go with checking for reply links.

Change 921660 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Delay the load of VE modules until we're sure they're needed

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

DLynch added a project: Editing QA.

The patch we've merged will make it so the VE modules are only loaded on pages that contain comments or the new-topic tab, which should not include the mediawiki.org front page. On pages that don't contain those but which somehow allow DT to be initialized, it'll still work, it'll just delay the loading until DT is actually invoked.

QA: the description shows how to tell whether the VE modules are loaded. You'll have to wait for it to be off-beta to verify the specific complaint about mediawiki.org, of course. Otherwise, if you could double-check that the VE JS is being automatically loaded on pages that contain discussions...