Unofficial Hacker News companion — get notified on comment replies, and more.

Show HN: misa77 – Up to 3x faster decompression than zstd, with better ratios (opens external site)

247 points by nonadhocproblem 15 hours ago github.com 81 comments (opens Hacker News) Vote (opens Hacker News)

View full thread · View on Hacker News

Comment thread (6)

  1. Replies (1)
    1. Thanks for the numbers!

      Some of the inefficiencies (for instance, the compressor's allocated state not persisting across calls) are definitely addressable but overall, clickhouse is probably not that great of a fit, as encode speeds matter to it.

      The data distribution also isn't the best as I've made several choices that help compress game data better, but hurt here. Performance on textual data (amazon_reviews) looks quite good.

      zstd -1 being close on ratio to level 11 at 64 kb is also quite surprising, as in my testing, level 11's ratio is much better on most data (even with 64 kb blocks).

      Another thing is the architecture, the gap between misa77 and zstd/zxc is typically widest on x86-64 (linux) and apple silicon, which wasn't tested.

      Replies (1)
      1. Relatedly, if I were you I would remove the part of the GitHub description claiming “much faster decompression than LZ4” at “better ratios”. The ZSTD piece is fine and has been achieved before, but the LZ4 claim is blatantly dubious to those in the know. LZ4 spends most of its time in memmove(), so getting much faster is unlikely lest you or your models found optimizations there. You could go reasonably faster with better LZ77 parsing, offering simply less work to load data, but I would be suspicious that morphing match chain can be surpassed substantially (see lz4hc). If so, a direct claim regarding such an achievement would be convenient to a skeptical reader. Very easy to find benchmarks that give huge swings, easy to trick oneself into believing in magic wins (as all compression enthusiasts know personally).
        Replies (1)
        1. LZ4 has been beaten at this point by several codecs independently, including zxc. In fact, as early as 2018 with lzsse (https://github.com/ConorStokes/LZSSE) and Oodle Selkie.

          Beating LZ4 is literally the least surprising claim here, and you can reproduce the results yourself through lzbench, turbobench, or even a custom harness. Both of the aforementioned harnesses also publish benchmark results which clearly demonstrate this gap.

          - lzbench: https://github.com/inikep/lzbench#benchmarks

          - turbobench: https://github.com/powturbo/TurboBench/blob/master/turbobenc...

          These speedups are possible by separating command and literal streams and a bunch of other tricks, which allows for better OoO execution. I also reduce branches by reducing maximum match length to 32, and enforcing a minimum match distance of 32 (so we can resolve matches with a single unconditional vector copy).

          Replies (1)
          1. Separating streams might give marginal perf wins, but capping match distance to 32 should kill ratio on many kinds of data- highly dubious! Even in the links you provide, no good evidence! Both are still on Selesia!! The originating comment and I are essentially both pointing this out (though, they give direct evidence and I attempt to give the reason)! LZSSE and Selkie I agree are fast, but I’ve never seen any evidence for “much faster”- all roughly operate around memcpy/memmove speed for a reason! Did you read what I wrote? Though I understand getting defensive and perhaps aggressive, please pardon my callousness- sorry!
            Replies (1)
            1. You're clearly trolling (I hope so), so I'm not going to continue engaging.

              Closing remarks:

              - LZ4 is way slower than memcpy, I don't understand why you're making stuff up lol.

              - The clickhouse benchmarks clearly show (on non-silesia data) that misa77 is way faster than LZ4 while attaining similar ratios on most data.

              - Selkie is faster than LZ4 and compresses much better on most data.