You don’t see it nearly as much as you should, but some web developers and server administrators are intelligent enough to put a compression filter (or module) in front of their web servers. When a browser that supports compression, the filter / module kicks in, and compresses the HTML, Image, Video, Flash or whatever is being fetched. The compression means that the file moves over the wire faster. Or at least thats the theory.
The fact is that for some instances (generated HTML code for example), the effort of compressing the file is more than it’s worth. In other instances (large images, or any static content for that matter), compression can make a huge difference. So I’ve started working with the idea of “Backward Compression”. The files are stored as “GZIP” files on the disk, if a browser that does not support compression requests the file, my filter decompresses it and sends it to the client. This has several advantages over compressing the files:
- Most browsers support compression, so the file can be sent as is
- GZIP decompression is cheaper than compression
- Less effort is expended by decompressing for the browsers that don’t support GZIP
- You can decide up front what should be compressed and what shouldn’t