If your website has deflate/zip compression enabled is there any point to JavaScript minification?
My theory is that the difference between a compressed minified JavaScript file and a compressed unminified JavaScript file is negligible.
There are very few browsers left out there that don’t support compression. I would imagine that some bots (spiders) might not support compression (I know of at least one) but they are unlikely to be “interested” in your JavaScript as they are unlikely to be executing JS and so shouldn’t be downloading it.
Let’s just test it. I used jQuery 1.4.2 and gzip (without flags;
-9does not seem to make a significant difference) to get the following numbers.So, in this particular case, minification makes the file nearly twice as small. Admittedly, the development release is full of comments. Let’s strip those out, and see what happens:
That’s still significantly larger than the minified version.