Using the zlib implementation of gzip with default parameters.
On a server facing the Internet, the quad-core Xeon processor cpu 2.66Ghz, the gzip compression time is less than 0.5 ms to 15 KB. 361Kb is 4.50 ms, and 1077 kbps takes 13 ms
I believe that this is still easily worth it, since most of our traffic travels via Wi-Fi or 3G channels, so the transmission time far outweighs the server latency.
Time is measured using code bracketing only to call gzip routines and use nS precision timers, I changed the source to implement this. I measured this anyway, as I was trying to determine if gzip should be cached for in-memory compromises, or if gzip was fast enough anyway. In our case, I think that we will gzip all above 200 bytes and aggressively cache gzip'd responses, especially for larger packages.
(@Mark adler, thanks for writing zlib)
source share