On Sun, 30 Dec 2007, Marco Costalba wrote:
Sorry to ask, but just out of curiosity, what were the reasons to
choose zlib compression algorithm among the possible ones?
It's out there, it's common, it's stable, and it's very good "on average".
In other words, other compression methods tend to be worse. No, zlib isn't
perfect, but it was the obvious default choice for me (I've used it
before, we use it in the kernel, it's usually good enough), and I actually
expected the SHA1 to be the bigger expense.
Even today, I don't really know of a better compression choice, despite
now being more aware of how critical uncompression performance is.
And quite honestly I'm not really even sure that the performance downside
is entirely about zlib itself: I suspect a lot of the reason zlib shows up
in the profiles is that the source data is usually cold in the cache, so
it probably takes a lot of cache misses (it also will take all the page
faults!).
Quite possibly, the cache miss costs dominate over any algorithmic costs.
Linus