Live data from Hacker News

Minification Is Evil

todepond.com

41–50 of 93 posts

Re: Minification Is Evil

#42

Not minifying your code is evil from the viewpoint of people who have to wait for your page to load.

An easy solution would be integrating a code unminifier/beautifier and viewer into browsers.

Source maps are a thing, which has the added benefit of letting you ship the comments if you actually care to educate your users on how your website works.

Re: Minification Is Evil

#43
post #31
post #21

Don’t agree with this take. Sacrificing the performance for all my users so a minuscule percentage of them can poke around a little easier? All the JavaScript is likely transpiled anyway. They can use dev tools to unminify most of it. Deploying with source maps for production might be a better ask?

How big is your JS that minification has measurable performance impact? In my experience, minification doesn't add much (if anything) on top of gzip + cache for most applications.

Given enough request it could add up. Maybe not big savings for a majority of sites though.

Re: Minification Is Evil

#44
post #31
post #21

Don’t agree with this take. Sacrificing the performance for all my users so a minuscule percentage of them can poke around a little easier? All the JavaScript is likely transpiled anyway. They can use dev tools to unminify most of it. Deploying with source maps for production might be a better ask?

How big is your JS that minification has measurable performance impact? In my experience, minification doesn't add much (if anything) on top of gzip + cache for most applications.

Yeah, the way compression works, I wouldn't expect minification to reduce the transfer sizes to any significant degree, as it's basically layering a good compression algorithm on top of a bad one. In general compression algorithm matroshka dolls tend to be inferior in terms of size and speed when compared to just using one good algorithm.

Re: Minification Is Evil

#45
Sadly, not minifying source code can often lead to your idiot customer discovering that their web app is not a magic binary blob and complaining that it's "insecure! anyone can see how it works!", which then in turn leads to your idiot PM agreeing to a new "obfuscate all code" feature without bothering to involve anyone technical.

Deliberately obfuscated JS is far more evil, take it from someone who's had to debug 3rd-party obfuscated JS libs.

Re: Minification Is Evil

#46
Minification always struck me as a cargo culting type way that "badass rockstar programmers would get every last ounce of performance" out of their code.

Because as noted below minification is much less impactful than compression, but going even further, if you really care about performance the solution is as simple as not shoving 20 metric boatloads of JavaScript in your website in the first place.

If you're argument I'd "muh rural customers" then maybe you should actually look at how your website is designed and ask yourself if you need to ship 3 different frameworks to accomplish what you need to do, or maybe start by stripping out the bloated analytics and ad nonsense in your code.

At the end of the day the author is right, the arguments about whether minification is useful is a teachincal argument, but the business will always want it for the purposes of obfuscating their code, and so we need to push back against the idea of it being an industry norm otherwise managers will push to make it so.

Re: Minification Is Evil

#47
post #27

I think minification should be done on another layer: HTTP compression and HTTP parallelization and that kind of stuff. And just don't make a complex web app, so it will be fast.

> just don't make a complex web app, so it will be fast

I never thought about that, I will just tell my customers that I removed all non-trivial features to make the app load faster. Also, there won't be any new features. I'll report back on how it goes.

Re: Minification Is Evil

#49
post #20

With GZIP and moreso Brotli the difference in actual data transfer is negligible anyway. Minification doesn't really achieve much other than obfuscation these days.

I just checked: 514kB gzip vs 314kB minified+gzip. Not negligible, IMO.

Re: Minification Is Evil

#50
post #34

Not minifying your code is evil from the viewpoint of people who have to wait for your page to load.

Doesn't gzip compression & source maps take care of this withou the abomination that is minification ?

Using the largest, unminified, single file I could find in my node_modules folder (which happened to be tsserver.js from typescript, 11mb and 185 000 lines long)

Raw: 11 403KiB

Raw gzipped: 1 881 KiB

Minified: 3 543 KiB

Minified gzipped: 865 Kib

A 2.17x reduction between the two gzips

Even with GZip, minification is huge

Post reply on HN