Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why? Why minify everything? It all gets gzipped at the HTTP layer anyway! I truly cannot understand this need to minify everything (JS included)


I started by downvoting your comment, and I realized I was choosing the cowardly way of reacting. I am saying this just to illustrate my own shallow reading of your comment at first and how I was avoiding actually being helpful.

The short answer is that 99% of the time no purpose is being served by that cruft except to be bloat. Minifiers remove that cruft and optimize for the intended audience, which is machines.

The longer answer is that in optimizing for machines, you're also optimizing for humans in the long run. Anyone stuck with a 2G connection, dial-up, or Bluetooth tethered device, or a new ultra low powered device on a different CPU architecture, will appreciate not having to operate solely in the world of gigabit+ connections, 8GB mobile devices, or 8 core hyperfast CPUs. Realize that such use cases still exist, and for very legitimate, not truly edge cases.

Think of pages with hundreds or thousands of vector images. Not everyone can afford to run a Blink-powered browser or have CPU cycles for days. Every little bit helps.

Edit to fix typo and add further clarity.


Fun fact! SVG is one of those things that is often easy to minify down below your nginx/apache/cdn minimum gzip length.

If your SVG files are < ~1kb, it's usually faster to just not gzip them. If they're < ~150b, gzipping will probably make both slower _and_ bigger.


It doesn't always get gzipped. That is highly dependent on the server.

Minification usually reduces code size, and some minifiers will also implement various optimizations.


Because when the browser un-gzips it, it takes a lot more memory than the minified version. And everyone seems to complain about browser bloat.


Did you read the article? SVGs are super crufty and extremely easy to optimize.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: