3 ms·
> Key to optimizing it was having a database that supported different compression strategies based on the data. I keep wondering why automatic detection of a c
by lucb1e 4y ago
> Key to optimizing it was having a database that supported different compression strategies based on the data.
I keep wondering why automatic detection of a compression strategy is hardly ever used. Different algorithms are just better at different things.
I thought timsort was one of the few things that does this, but a quick look at Wikipedia actually indicates that I misremember. With that gone, off the top of my head I cannot think of any utility or library that does this sort of thing. It doesn't seem hard to just take a few kilobytes of data, try a handful of good algorithms, pick the best one, and repeat after a few megabytes. I imagine the gains should be double digit percentages for at least a fifth of the datasets out there, without necessarily losing out on (de)compression speed. Curious if anyone ever looked into this, though some uncertainty will always be about bias in the dataset selection.
E.g. 9 out of 10 times xz is clearly better than bzip2 (both at max compression setting), but then sometimes bzip2 actually beats xz with some margin. I don't know when or why, but it has me trying both options whenever I care about the final compressed size. I've also had that a lower level of gzip actually compressed better (I think it was -8 vs -9, but it also have been between -1 and -3 or so).
- spullara 4y agoI've always liked this kind of thing. I've also done some experiments with automatically memorizing better starting dictionaries for a corpus eras where the data is small: https://github.com/spullara/corpuscompression https://github.com/spullara/corpuscompression Another interesting case is using a compressed stream to indicate anomalies in the data when the compression ratio spikes down like in log analysis.