Google launches Zopfli, a better zip compressor for static content

The venerable DEFLATE algorithm just got better thanks to a new open-sourced project from Google, but it is not without its costs.
Written by Chris Duckett, Contributor

What is known as ZIP to most of us, is actually the DEFLATE algorithm, and Google has made it slightly better.

The search giant announced Zopli today, which is a new compression algorithm that is compatible with existing DEFLATE decoders, and produces slightly smaller files at the cost of increased CPU load during compression.

Google said that the smaller files produced by Zopfli will result in faster data transmission, lower web page load latencies, and reduced battery use in mobiles.

An example of the cost and benefits can be found in a four page paper authored by Google. In it, four data sources are used: the homepages of 9,148 out of the 10,000 most popular websites; two collections of files known as the Calgary Corpus and the Canterbury Corpus; and enwik8, 100MB of Wikipedia. These files are run through gzip, 7-zip, kzip at maximum compression settings, with Zopfli using its default settings.

At the end of the tests, Zopfli files come out 3.7-8.3 percent smaller, but the computational time needed to compress Zopfli is 81 times more than what gzip needs.

Uncompressing the files is a different story, with Zopfli being the fastest of the tight bunch of results.

Based on these results, Google is recommending Zopfli for a particular use case.

"In the light of the results we presented, we recommend Zopfli for compression of static content, and other content where data transfer or storage costs are more significant than the increase in CPU time," the report suggested. "To our knowledge, Zopfli typically produces the highest compression density of any deflate-compatible algorithm."

Clearly this is not a general use algorithm, but for those designers and developers that are obsessive about shaving a few bytes here and there on images and files, it could be a good alternative.

The fact that a new inflater is not needed, means that Zopfli is ready to use today and that client-side applications need not be updated. A good approach that means that the vast majority of internet users need not know or care of its existence, but it has a chance to be a viable tool for cutting a little bit of cost from traffic-heavy websites.

The CPU intensity/secret sauce in Zopfli is its more exhaustive compression techniques that are "based on iterating entropy modelling and a shortest path search algorithm to find a low bit cost path through the graph of all possible deflate representations".

Zopfli is licensed under the Apache Licence 2.0.

Editorial standards