Category Archives: Algorithms

The Simple Beauty of XOR Floating Point Compression

I recently implemented a small program to visualize the inner workings of a scheme that compresses floating point timeseries by XORing subsequent values. The resulting visualizations are quite neat and made it much easier for me to understand this beautiful algorithm than any of the explanations that I had previously encountered.

Hacker News (280 points, 68 comments)

The algorithm

The algorithm1This particular version of XOR floating point compression was first described in “Gorilla: A Fast, Scalable, In-Memory Time Series Database” and is often referred to as “Gorilla compression. is simple. We start by writing out the first floating point number in full. All subsequent numbers are XORed with the previous number and then encoded in one of three ways:

Continue reading