Last time we took a look at the performance impact of using tabs vs. spaces in HTML files. One question that arose was whether or not it’s worthwhile to minify HTML when also using GZip. Let’s run the experiment.
I’ve collected a few real-world HTML files and done some minification and GZipping on them. Here’s the result:
|Website||File size||Minified||Gzip||GZip & minified||Savings|
These pages already do minification on various sections, but none of them minifies the whole document. If none of them used any minification, the savings would have been higher than the table shows.
So, according to the results, minification will provide an additional 6-16% lower file size with GZip enabled.
16% is a rather large saving on top of regular GZip, so the data suggests that we must use both GZip AND minification.
Remember, this is a rather small experiment with only 4 real-world websites. It would be interesting to expand the experiment for more accurate statistics.