by Retr0id · 3y ago · 0 comments
I'd also be interested to see what zstd (or even just gzip) would make of their original un-optimised format - I bet you'd get most of the way there "for free".
https://gist.github.com/jmfd/8dbb96fcd8a1ba1e8ad6e9167bd70ce...
And then tried these commands against it:
gzip: 39.56kb (93.7%)
zstd: 35.86kb (94.3%)
gzip -9: 35.51kb (94.4%)
bzip2: 24.35kb (96.1%)
zstd -19: 24.01kb (96.2%)
brotli: 21.42kb (96.6%)
(I'm not up-to-date on default web server configs, but I imagine most would automatically transmit with gzip over the wire for json?) gzip: 6.95kb (98.9%)
brotli: 5.99kb (99.0%) img: 13.552kb (100%)
img.png: 1.877kb (13.8%)
img.qoi: 10.316kb (76.1%)
img.qoi.gz: 1.167kb (8.6%)
While it does compress by 50%, it's not a format optimized for compression unlike png or qoiYou're also going to be relying on heuristics that may fail. Zstd has no idea that your UUIDs are going to repeat, it doesn't know to dictionary encode them or to create frequency mappings. What it ends up doing is unlikely to be as effective as doing the work ahead of time, then allowing zstd to find the interesting and complex patterns that arise out of your encoded format.