Gzip::Zopfli - another compression module

Following on from the Gzip::Libdeflate I mentioned before, I also made this: Gzip::Zopfli

It is based on the Zopfli gzip compression library from Google Research.

Both Zopfli and libdeflate seem to excel at compressing JSON files compared to the ordinary zlib compression, sometimes with an improvement of up to 30%. Zopfli usually wins by a small margin over libdeflate. Here are some results of this script on random JSON files:

6194 698 703 682
3809 1184 977 953
1446 494 486 485
1572152 824430 710102 707844
28061 5080 4554 4546
565082 125097 118708 118494
317448 164741 140087 139829
2069690 1062866 865985 866129
565082 125097 118708 118494

On the left is the uncompressed size, then gzip -9, libdeflate, and zopfli number of bytes.

Zopfli almost always wins by a small margin over libdeflate.

People who want to try comparing the three things might find this repository useful:

At the time of publishing this blog post, the scripts will require a little editing to work.

Leave a comment

About Ben Bullock

user-pic Perl user since about 2006, I have also released some CPAN modules.