4 ms·
Doesn't really matter after compression unless the bulk of your code can be culled from the end product. Tbh the largest business value this has is slowing down
by BanTheBastards 3y ago
Doesn't really matter after compression unless the bulk of your code can be culled from the end product. Tbh the largest business value this has is slowing down people trying to use your internal APIs.
- kibwen 3y agoIt would be nice to have experimentally-derived numbers to point to in order to help people visualize whether or not minification actually improves compression to any significant degree.
- TheMaskedCoder 3y agoHere's an old article: https://css-tricks.com/the-difference-between-minification-and-gzipping/ https://css-tricks.com/the-difference-between-minification-a... In the example given: Original - 147 KB Minified - 123 KB (83%) Gzipped - 22 KB (15%) Both - 20KB (14%) Compression is waaay more effective, so if you have to pick one, go with compressing. Is having readable source code worth the other 2KB? That's up to you. Source maps can do the same thing with less, though. Also, modern devtools have ways of de-minification (if you don't mind all the mangled variable names).
- ruszki 3y agoI've seen the same thing with different jQuery versions: https://stackoverflow.com/questions/3239125/is-there-any-point-to-javascript-minification-if-you-have-compression-turned-on https://stackoverflow.com/questions/3239125/is-there-any-poi... At least with jQuery, it seems that minification matters considerably.
- tecleandor 3y agoQuick test I've done with some popular frameworks. I wonder if minification affects to parsing speed. +--------------------------+---------+---------+---------+--------+ | Library | Size | gzip -1 | gzip -9 | brotli | +--------------------------+---------+---------+---------+--------+ | bootstrap.css | 280813 | 47312 | 33109 | 24533 | | bootstrap.min.css | 232948 | 42003 | 30776 | 22695 | | react.development.js | 87574 | 28733 | 23513 | 19818 | | react.development.min.js | 25612 | 10217 | 9224 | 8052 | | tailwind-2.2.19.css | 3642321 | 376787 | 304100 | 82049 | | tailwind-2.2.19.min.css | 2934019 | 354063 | 294632 | 72803 | | vue.global.js | 476920 | 134655 | 105130 | 87121 | | vue.global.min.js | 167898 | 74769 | 65582 | 57922 | +--------------------------+---------+---------+---------+--------+ Edit: something important to note: some frameworks (e.g. React) have lots of comments on their un-minified versions, that are removed when minified. That affects their size greatly.
- sebstefan 3y ago> Edit: something important to note: some frameworks (e.g. React) have lots of comments on their un-minified versions, that are removed when minified. That affects their size greatly. Are you telling us your code doesn't? :-)
- PaulHoule 3y agoOften I avoid comments by using long names for functions and variables (e.g. the test whose name is a statement of the postulate behind it) and minimization squashes many of those.
- tecleandor 3y agoHah! It's self-documenting! Nah, in a more serious note, to properly compare the impact of minification, I should remove the comments from the unminified (maxified?) version first. :)
- sebstefan 3y agoNah that wouldn't be fair, the code I serve my users initially has comments too and the arguments that people bring to criticize minification is that it adds complexity if you want to read the code in the browser. The comments should stay
- falserum 3y agoCan client/browser choose if to use compression? If so, this is a problem for the website
- progval 3y agoYes, HTTP Accept-Encoding