To GZIP or not to GZIP

When the question to GZIP or not to GZIP is raised I’m sometimes asked if the cost (in time and battery usage) of decompressing data on the client is balanced against the gains in transport efficiency. “Yes, I assume it is, otherwise why would Yahoo propagate it?”, was mostly my answer.

I was pleased to see that the W3C gives a more thorough answer to this question in it’s section on Mobile Web Application Best Practices:

Web servers should be configured to serve appropriately compressed responses. However:

  • Most image formats (especially JPEGs) do not benefit from compression, but SVG does;
  • Most other media formats (e.g. audio, video) do not benefit from compression;
  • Very small files (e.g. <1k) generally do not benefit from compression.