Lucas_Werkmeister_WMDE added a comment.
> So after gzip, we almost cut the init module in half (☺) but bloat the app
module by more than that amount (☹).
It occurred to me that a lot of this might be due to the fact that the init
module is more minified than the app module, so here’s another table with even
more numbers.
| file | size before | size after |
| -------------------- | ----------- | ---------- |
| init | 92 kB | 58 kB |
| init, gzip | 29 kB | 17 kB |
| init, uglifyjs | 91 kB | 58 kB |
| init, uglifyjs, gzip | 29 kB | 17 kB |
| app | 323 kB | 429 kB |
| app, gzip | 72 kB | 97 kB |
| app, uglifyjs | 104 kB | 141 kB |
| app, uglifyjs, gzip | 32 kB | 43 kB |
|
(Numbers obtained by running `for file in dist/data-bridge.{init,common}.js;
do wc -c < "$file"; gzip < "$file" | wc -c; uglifyjs -c -m < "$file" | wc -c;
uglifyjs -c -m < "$file" | gzip | wc -c; done | numfmt --to=iec` on master and
my branch. kB means 1000 bytes, gzip is v1.9, uglifyjs is uglify-es 3.0.19.) So
after uglification, init shrinks by 33 kB and app grows by 37 kB, a 4 kB
difference; after uglification and gzip, init shrinks by 12 kB and app grows by
11 kB, a 1 kB difference in the other direction.
While there are probably some rounding errors in there and this might vary by
gzip/uglify settings (you could also use a different uglifier), in general this
suggests to me that my change does not, in fact, bloat the app module with code
conjured out of thin air. A roughly equivalent size of code seems to have moved
from the init to the app module – it just looked otherwise because it moved
from a more-compressed module to a less-compressed one.
(I don’t quite remember if the app module being less optimized/compressed was
a conscious decision we made or just a consequence of how we set things up. In
theory, it’s nice to be able to see the original code in the browser debugger
when using ResourceLoader debug mode, but I admit I haven’t actually made use
of that yet. Perhaps we should compress the app module after all?)
TASK DETAIL
https://phabricator.wikimedia.org/T235771
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Lucas_Werkmeister_WMDE
Cc: Lucas_Werkmeister_WMDE, Aklapper, Pablo-WMDE, Hook696, Daryl-TTMG,
RomaAmorRoma, 0010318400, E.S.A-Sheild, darthmon_wmde, Meekrab2012,
joker88john, Michael, DannyS712, CucyNoiD, Nandana, NebulousIris, Gaboe420,
Versusxo, Majesticalreaper22, Giuliamocci, Adrian1985, Cpaulf30, Lahi, Gq86,
Af420, Darkminds3113, Bsandipan, Lordiis, GoranSMilovanovic, Adik2382,
Th3d3v1ls, Ramalepe, Liugev6, QZanden, LawExplorer, WSH1906, Lewizho99,
Maathavan, _jensen, rosalieper, Scott_WUaS, Wikidata-bugs, aude,
Lydia_Pintscher, Mbch331
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs