Live data from Hacker News

Show HN: misa77 - a codec that decodes 2x faster than LZ4 (at better ratios)

github.com

11–20 of 51 posts

Re: Show HN: misa77 - a codec that decodes 2x faster than LZ4 (at better ratios)

#11
post #5

Interesting, but if you are not robust to corrupted/malicious data, it is really in a different class of algorithm and it is hard to compare speeds directly. From memory, 2505 MB/sec also sounds on the low side for LZ4 on a modern CPU?

You mean some kind of error detection? LZ4 doesn't have that.

Have defined behaviour on any input, i.e not causing security issues, memory safety issues on untrusted inputs. Lz4 has this.

Re: Show HN: misa77 - a codec that decodes 2x faster than LZ4 (at better ratios)

#12
From status in readme in github:

- misa77's format may change unexpectedly as it's still v0.x.y.

- The decoder assumes that the input is a valid misa77 stream. Invalid input is UB and I offer no guarantees for whatever misa77 does in this case.

- It's been through some local fuzzing but is not hardened, so treat it as experimental.

Re: Show HN: misa77 - a codec that decodes 2x faster than LZ4 (at better ratios)

#15

this is super interesting! im excited to give this a look this afternoon, since I specifically have wanted faster throughout for decompressing maps in a game engine.

You can look at the LZ4 decompression implementation in ClickHouse: https://presentations.clickhouse.com/2018-highload-siberia/ (the presentation is quite old, but the implementation was updated recently). It uses the same LZ4 format, just decompresses faster.

Re: Show HN: misa77 - a codec that decodes 2x faster than LZ4 (at better ratios)

#16

It is slower than LZ4 on AArch64.

Could you tell me what your test setup and corpus was?

For reference, to test ARM64, I tested v0.1.0 on an M3 mac with this fork of lzbench: https://github.com/welcome-to-the-sunny-side/lzbench/tree/ad...

Here, lz4's decompression speed was far slower than misa77 and zxc. Results are here: https://github.com/welcome-to-the-sunny-side/misa77/blob/mai...

Re: Show HN: misa77 - a codec that decodes 2x faster than LZ4 (at better ratios)

#17

It is slower than LZ4 on AArch64.

Source?

Just tested a few minutes ago on the ClickBench dataset. Overall quite good, but, depending on particular columns, most of the time slower - e.g., ~2.0 vs ~2.8 GB/sec on Graviton 4 machine in AWS.

Re: Show HN: misa77 - a codec that decodes 2x faster than LZ4 (at better ratios)

#18

Earlier quoted context omitted.

Source?

Just tested a few minutes ago on the ClickBench dataset. Overall quite good, but, depending on particular columns, most of the time slower - e.g., ~2.0 vs ~2.8 GB/sec on Graviton 4 machine in AWS.

You probably meant MB/sec not GB.

Re: Show HN: misa77 - a codec that decodes 2x faster than LZ4 (at better ratios)

#19
So, I couldn't see it in the readme, apologies if I missed it but why?

It's a very significant speedup in decompression speed (albeit with a compression speed slowdown as a trade-off), but what's the insight that makes it faster? What was the idea or approach behind it?

Re: Show HN: misa77 - a codec that decodes 2x faster than LZ4 (at better ratios)

#20

So, I couldn't see it in the readme, apologies if I missed it but why? It's a very significant speedup in decompression speed (albeit with a compression speed slowdown as a trade-off), but what's the insight that makes it faster? What was the idea or approach behind it?

So it's essentially "LZ4 unshackled". I've made several modifications to the LZ4 format, most of which are in service of eliminating branches/making them more predictable, and making decompression very friendly to out-of-order cores by hiding false data dependencies behind a rarely taken branch (similar to this: https://news.ycombinator.com/item?id=48889148).

Some concrete changes in the format are:

  - match length per block is capped to 32
  - distance to a match must be >= a fixed constant
  - unlike lz4, tokens and literals have separate streams
  - format of the token byte has been changed
Now, this format allows our decompressor's hot loop to be very simple (in terms of the number of branches it has). This simplicity in turn allows our compressor to create a compressed stream that is friendly to the (small number of) branches in the decompressor.

The experimental compression modes (see readme) attempt to exploit this even further (but are even slower at compression). I define a "cost", which is a linear function of the branches induced by a compressed stream (this function serves as a proxy for decompression time), and then do a DP to minimise this cost.

Post reply on HN