Why is HTML/Javascript minification beneficial

Posted by Channel72 on Programmers See other posts from Programmers or by Channel72
Published on 2012-06-29T11:20:51Z Indexed on 2012/06/29 15:22 UTC
Read the original article Hit count: 476

Filed under:
|
|
|

Why is HTML/Javascript minification beneficial when the HTTP protocol already supports gzip data compression?

I realize that Javascript/HTML minification has the potential to significantly reduce the size of Javascript/HTML files by removing unnecessary whitespace, and perhaps renaming variables to a few letters each, but doesn't the LZW algorithm do especially well when there are many repeated characters (e.g. lots of whitespace?)

I realize that some Javascript minification tools do more than just reduce size. Google's closure compiler, for example, also tries to improve code performance by inlining functions and doing other analyses. But the primary purpose of Javascript minification is usually to reduce file size.

I also realize there are other reasons you might want to minify aside from performace, such as code obfuscation. But again, that reason is not usually emphasized as much as performance gain and file size reduction. For example, Closure Compiler is not advertised as an obfuscation tool, but as a code size reducer and download-speed enhancer.

So, how much performance do you really gain from Javascript/HTML minification when you're already significantly reducing file size with gzip compression?

© Programmers or respective owner

Related posts about JavaScript

Related posts about html