4 ms·
I am really curious about the minimized and gzipped size differences. I created a library a while back[1] and experimented with extreme fileweight (it's an alte
by franciscop 10y ago
I am really curious about the minimized and gzipped size differences. I created a library a while back[1] and experimented with extreme fileweight (it's an alternative to jQuery with just 3kb minimized + gzipped). I also wrote the topic from what I learned:
https://medium.com/@fpresencia/understanding-gzip-size-836c74b66c0b https://medium.com/@fpresencia/understanding-gzip-size-836c7...
Depending on the code, even if it seems quite large initially it might minimize and gzip quite well. Actually, automatic code generation is the perfect candidate for a good compression. One of the reasons is because this:
(function(module, __webpack_exports__, __webpack_require__) {})
Will become just:
(function(a,b,c){})
Which is 5char/function difference with the other example shown in the article with uglify. It becomes negligible when we take into account gzip, since that will be stored only once and then it's just 5char difference overall. So an apparent "module, __webpack_exports__, __webpack_require__" x N becomes just 5bytes of difference in total.
[1] http://umbrellajs.com/ http://umbrellajs.com/
- rpeden 10y agoIt's useful to consider not just download size, but also the time required to parse the extra code, and the extra memory used by the code that's parsed and loaded into memory, but not actually used. Probably not a concern for desktop/laptop users, but there are plenty of mobile devices out there with relatively slow processors and 1GB of RAM or less.
- pspeter3 10y agoFrom Asana's page load numbers, it seems like most browsers now cache both the fetch and parse stages. The evaluation time is still a huge deal and I think the "Cost Of Small Modules" article that is referenced actually explains why quite well.
- franciscop 10y agoTotally, however that article was mainly about compression file size. The main problem when we get to optimization is that it highly depends on the browser and version. Parse time is still important, but I'd argue that it's related to both file size and processing power needed, but still less important than both of those.