Re:Security concerns with minified JavaScript code
by justincormack on Monday August 31, 2015 @11:50AM
(#10147363)
You can pre-gzip, or cache the gzipped version; some servers do; in fact storing the gzipped version and occasionally uncompressing it for clients that cant do compression is much more efficient than the reverse as uncompressing is much faster.
Re:Security concerns with minified JavaScript code
by wang_li on Monday August 31, 2015 @11:57AM
(#10147400)
You can store both on disk, apache at least, will figure out if the client can handle gzipped content and will send the compressed version when possible.
Re:Security concerns with minified JavaScript code
by arihant on Monday August 31, 2015 @02:42PM
(#10148333)
But doing cache in this way sort of defeats the argument. Why would one cache a gzip copy instead of minified or minified+gipped? And minified alone is more efficient than gzip and can work regardless of client preference.
The argument here is why not simply use gzip and not use minification at all.
Re:Security concerns with minified JavaScript code
by icebraining on Monday August 31, 2015 @12:23PM
(#10147530)
Same for nginx, using the gzip_static module: http://nginx.org/en/docs/http/ngx_http_gzip_static_module.ht...
Re:Security concerns with minified JavaScript code
by NoMoreNicksLeft on Monday August 31, 2015 @01:33PM
(#10147971)
> Gzip is not free. You would have to perform it on every single request. That costs money. Minification is a one time thing.
Do it once and cache.
1. Gzip is not free. You would have to perform it on every single request. That costs money. Minification is a one time thing.
2. Gzip does not strip documentation.
3. Gzip, as you mentioned, cannot do language specific compression. So if your code is written poorly and can be better written with a closure, Gzip won't do that for you. Proper minification will.
4. Gzipping minified code is cheaper than gzipping non minified code.
5. Minified code uses lesser breadth of variable names and literals. This makes for more efficient Gzip.
As others have mentioned - Gzipping gives around 50% compression, full minification around 70%, and both combined around 80-90%. So if you go whole nine yards, you can save 40% extra on bandwidth. That could equate to thousands of dollars in saving every month for even a moderately famous web app.