The single RL model mw.cx.visualeditor is growing and it has everything related to the integration. It should be split into small logical groups with correct dependencies.
This split up may also help us defer some RL modules from page load.
The single RL model mw.cx.visualeditor is growing and it has everything related to the integration. It should be split into small logical groups with correct dependencies.
This split up may also help us defer some RL modules from page load.
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Refactor the mw.cx.visualEditor RL module to logical groups | mediawiki/extensions/ContentTranslation | master | +148 -47 |
Can you explain why this is a high priority issue?
35 133 923 ve-cx/dm/ve.dm.CXTranslationUnitModel.js 61 190 2053 ve-cx/dm/ve.dm.CXLinkAnnotation.js 73 183 1982 ve-cx/dm/ve.dm.CXSentenceSegmentAnnotation.js 54 200 1577 ve-cx/dm/mixins/ve.dm.CXLintableNode.js 121 404 3613 ve-cx/dm/ve.dm.CXSectionNode.js 105 378 3227 ve-cx/dm/ve.dm.CXBlockImageNode.js 34 90 917 ve-cx/dm/ve.dm.CXImageCaptionNode.js 56 159 1612 ve-cx/dm/ve.dm.CXPlaceholderNode.js 53 162 1419 ve-cx/ce/ve.ce.CXLinkAnnotation.js 43 111 1179 ve-cx/ce/ve.ce.CXSentenceSegmentAnnotation.js 52 129 1286 ve-cx/ce/ve.ce.CXSectionNode.js 44 108 1021 ve-cx/ce/ve.ce.CXBlockImageNode.js 27 64 647 ve-cx/ce/ve.ce.CXImageCaptionNode.js 68 171 1720 ve-cx/ce/ve.ce.CXPlaceholderNode.js 106 293 3488 ve-cx/ui/ve.ui.CXDestinationTool.js 35 138 1174 ve-cx/ui/ve.ui.CXTranslationUnitContextItem.js 118 352 3616 ve-cx/ui/ve.ui.CXLinkContextItem.js 222 635 6052 ve-cx/ui/ve.ui.CXSectionContextItem.js 33 71 902 ve-cx/ui/ve.ui.CXLinkAnnotationInspector.js 16 37 442 ve-cx/ui/ve.ui.CXLinkAnnotationWidget.js 114 436 3959 ve-cx/ui/ve.ui.CXTranslationToolbar.js 72 209 1708 ve-cx/ui/actions/ve.ui.CXTranslationAction.js 1542 4653 44517 total
We are talking about 44 KB of uncompressed code. Maybe we could deferred loading some of the files, but I doubt that's more than 20% of the size. In addition that deferral can introduce latencies later when people are actually trying to use the tool.
Let's have look at the big picture:
name | size |
ext.visualEditor.core | 799.0 KiB |
oojs-ui-core | 149.8 KiB |
oojs-ui-widgets | 124.4 KiB |
oojs-ui.styles.icons-editing-advanced | 90.3 KiB |
ext.visualEditor.mwtransclusion | 87.0 KiB |
moment | 85.7 KiB |
ext.visualEditor.mwcore | 76.3 KiB |
ext.visualEditor.mwmeta | 70.4 KiB |
oojs-ui-core.styles | 61.2 KiB |
unicodejs | 56.7 KiB |
ext.visualEditor.mwimage | 52.7 KiB |
oojs-ui.styles.icons-interactions | 52.3 KiB |
oojs-ui-windows | 51.5 KiB |
ext.visualEditor.diffing | 45.1 KiB |
mw.cx.visualEditor | 40.7 KiB |
ext.visualEditor.mwlink | 40.4 KiB |
oojs-ui-toolbars | 39.8 KiB |
ext.visualEditor.mwgallery | 37.9 KiB |
oojs-ui.styles.icons-content | 37.2 KiB |
oojs-ui.styles.icons-moderation | 36.8 KiB |
ext.visualEditor.mwlanguage | 36.6 KiB |
ext.cite.visualEditor | 36.3 KiB |
diffMatchPatch | 35.9 KiB |
jquery.uls.data | 33.7 KiB |
ext.visualEditor.base | 32.8 KiB |
oojs-ui.styles.icons-editing-styling | 30.6 KiB |
easy-deflate.deflate | 29.6 KiB |
ext.cite.visualEditor.core | 27.1 KiB |
mediawiki.widgets.MediaSearch | 26.1 KiB |
mediawiki.widgets.DateInputWidget | 26.0 KiB |
ext.visualEditor.mwimage.core | 25.8 KiB |
papaparse | 25.7 KiB |
ext.visualEditor.desktopArticleTarget.init | 25.6 KiB |
ext.geshi.visualEditor | 25.5 KiB |
oojs-ui.styles.icons-media | 25.3 KiB |
Smaller modules are omitted from the list. I believe there is some low hanging fruit here, like the diffing code that is probably not needed. I don't think it makes sense to optimize 41 KiB when we are loading over 1 MiB in dependencies.
In fact I would argue that we have a different problem: the extension.json is becoming very large and unmanageable because we have too many resource loader modules. It also puts pressure on the resource loader system and the list of all known resource loader modules is shipped with every page view as far as I remember.
I think we should group files together in logical modules to reduce the number of modules that we define and to simplify dependencies.
I think we should group files together in logical modules to reduce the number of modules that we define and to simplify dependencies.
I meant to address only this.
Change 432071 had a related patch set uploaded (by Santhosh; owner: Santhosh):
[mediawiki/extensions/ContentTranslation@master] Refactor the mw.cx.visualEditor RL module to logical groups
FYI: CX mentioned near the end of the description of T192623: ResourceLoader 2018 Review
Change 432071 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Refactor the mw.cx.visualEditor RL module to logical groups