Building a Custom Data Compressor: Squeezing Every Byte Out of Cricsheet JSONs

The Problem

Cricsheet JSONs are massive. If you’ve ever worked with them, you know they pile up fast—multiple gigabytes of structured cricket data that are 99% predictable and 1% useful. Standard compression tools like gzip and 7z only go so far because they treat the files as generic text and miss the patterns in the schema. The problem? You need an efficient way to shrink these datasets without sacrificing their integrity.

What This Does

This repo's compressor/ directory holds a custom data compressor that takes advantage of the predictable structure of Cricsheet JSONs. The magic happens in compressor/main.py, which implements a schema-aware compression algorithm. Instead of treating the data like a blob of random bytes, it intelligently encodes the known fields, removing redundancy that traditional compressors don’t catch.

There’s a writeup in compressor/README.md that walks you through the math behind the approach (spoiler: it involves entropy). The results are impressive—this technique shrinks a 2.87GB dataset down to just 42MB. Combine it with 7z, and you’re looking at 8.9MB. That’s absurdly small for something this large. Bonus points: the repo even includes visual evidence of the entropy reduction (compressor/media/entropy.png, because why not flex?).

The folder also has compressor/driver.py, which presumably handles batch processing or testing (the docs don’t say), and a few sample media files for... reasons. But the real action is in main.py.

Real-World Use

Imagine you’re running a cricket analytics platform. You need to store and process years of JSON data for matches without breaking the bank on storage. Here’s how you might use this:

Boom. Now your 3GB of data fits on a thumb drive, and your AWS bill won’t make you cry.

The Bottom Line

This project is a niche but elegant solution for anyone drowning in structured JSON data. If you’re not working with Cricsheet or similar datasets, you probably don’t need this—it’s not a general-purpose compression tool. The lack of stars and documentation polish might scare off casual users, but the results speak for themselves. If you’re into Algorithmic Information Theory or just want to geek out over squeezing every last byte, give it a look.