5 ms·
A few years ago I did some measurements of popular projects (Wikipedia, WordPress, default React, jQuery, few things like that) comparing minify, minify+gzip, a
by arp242 3y ago
A few years ago I did some measurements of popular projects (Wikipedia, WordPress, default React, jQuery, few things like that) comparing minify, minify+gzip, and just gzip, and found found that most minification beyond "removing comments" gives very little benefit even for poor 2G connections.
Especially things like removing as much whitespace as possible or replacing true/false with !0/!1 just don't really save a lot of space. The only two I found to make a significant difference were removing comments, and shortening identifiers (and usually with most of the savings being in "removing comments", depending on the amount of comments and code style).
- jackmott 3y agohow does minify affect the times to decompress and load the css I wonder?
- catlifeonmars 3y agoMy money is on much less than the time it would take to send the extra bytes over the wire. But I suppose measurement is key :D
- metalrain 3y agoUnless client combines decompress and CSS parsing, they would at least allocate memory for the whitespace before parsing and then skipping them. It might be better to have slightly bigger payload on the wire to save time after decompress.
- Gordonjcp 3y agoA lot of it reminds me of the olden days of Sinclair ZX81s with 1kB of memory, of which roughly half was free once you drew on the screen and defined a few variables. We used to write things like "LET A=COS PI" instead of "LET A=1", or "SIN PI" instead of 0, because keywords were represented as a single byte and numeric constants as five bytes so two keywords represented a useful saving of three bytes. Back then it made a huge difference but now that modern computers have hundreds or even thousands of kilobytes of RAM free it's a bit pointless.
- eythian 3y ago> Back then it made a huge difference but now that modern computers have hundreds or even thousands of kilobytes of RAM free it's a bit pointless. Jokes on you, now I'm running IntelliJ, DataGrip, Firefox, and Slack and thousands of kilobytes of RAM free is a rare sight to see.
- redeeman 3y agothey are really just doing us all a service, to remind us of the roots of computing, where every byte free was precious
- eyegor 3y agoYou should try running visual studio 2022 and teams. On a medium sized project vs2022 will happily gobble 10+ gb of ram, and teams will take 1-2 more without supporting any meaningful scrollback. Even with ~500 tabs I can't hit 10gb ram in ff (thanks to tree style tabs to make it feasible to have so many tabs open).
- Gordonjcp 3y agoYou know what EMACS stands for? Eight Meg And Constantly Swapping.
- arp242 3y agoThat joke was stale in 1994. You need to think of some new material.
- mschuster91 3y ago> Especially things like removing as much whitespace as possible or replacing true/false with !0/!1 just don't really save a lot of space. At the scale of Wikipedia (~10 billion pageviews a month), even a single byte saving can mean terabytes worth of bandwidth saved.
- distcs 3y ago> At the scale of Wikipedia (~10 billion pageviews a month), even a single byte saving can mean terabytes worth of bandwidth saved. But does it really move the needle anywhere where it matters? If you are serving a million bytes in every response but you manage to trim a single byte from it, I don't think it is going to move the needle anywhere. Sure it will save a terabyte when you have served a trillion responses. But in a trillion responses you are saving only one terabyte out of an exabyte of responses. That's not much!
- bawolff 3y agoAlso keep in mind that for big web properties bandwidth is sold very differently than it is to normal consumers. In many cases wikipedia probably isn't even paying for bandwidth due to peering agreement. As far as performance goes, i suspect whether a single byte matters depends a lot more on if the extra byte results in the same number of packets or not.
- djbusby 3y agoSo, why use two bytes for '!0' when just '1' works?
- tinyhitman 3y agoIts not strictly the same. '1' is a number whereas '!0' is a boolean.
- ilyt 3y agoI hate that language a bit more now