What are you doing this week?

16 points by caius


What are you doing this week? Feel free to share!

Keep in mind it’s OK to do nothing at all, too.

marginalia

Fiddling with value block compression in the marginalia index. Very cursed stuff.

A bit simplified, but I'm basically zigzag delta encoding[1] the data and then reshuffling it in byte planes, and then compressing them with LZ4.

So if I have for the sake of simplicity 64 longs that have been zigzag delta encoded, the data is rearranged into

(all the 1st bytes of the coded longs),
(all the 2nd bytes of the coded longs),
(all the 3rd bytes of the coded longs),
(all the 4th bytes of the coded longs),
(all the 5th bytes of the coded longs),
(all the 6th bytes of the coded longs),
(all the 7th bytes of the coded longs),
(all the 8th bytes of the coded longs)

The result of the zigzag delta treatment is that a lot of the most significant byte planes end up being very predictable, often long runs of zeroes. It's like the worst imaginable L1 cache access pattern since you need to read 8 different cache lines to assemble one value, but it nearly doubles the compression rate[2], which makes for fewer disk reads, and L1 cache misses are a drop in the ocean compared to an I/O roundtrip.

Real benefit is that it significantly slashes the disk requirements of the index, which is very chonky right now, and in the ballpark of half of the index is this data. Will probably save about 4 TB of disk space altogether when this goes live.

[1] Encode the difference between values, and then make every other value represent negative values, to avoid the bit flipping in two's complement, ensuring that smaller deltas (regardless of sign) stay toward the least significant bits.

[2] I'm getting about 70% compression which is very good for standard-mode LZ4.