Wednesday, September 5, 2012

GZipping vs Minification of JavaScript Resources

A debate that pops up every so often in the office is whether minification is worth it when you have GZip available.

The short answer:
  • GZipping is always a good idea, and better than nothing. 
  • Minification is always a good idea, and better than nothing. 

To find this out I looked at JQuery 1.8.1 from the Google Hosted Libraries. The results:
TechniqueSize (kb)
Original256
GZip76
Minified*91
Minified + GZipped33

So — you can reduce your JS (or JQuery, at least) size by three simply by GZipping. If for some absurd reason you can't GZip then you'd best at least minify, but you get the best performance by using both.

*I'm not immediately sure what tool was used for minification

No comments: