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)

245 points by nonadhocproblem 14 hours ago github.com 80 comments (opens Hacker News) Vote (opens Hacker News)

View full thread · View on Hacker News

Comment thread (23)

  1. I'm also working on a better compression algorithm. It decompresses up to 6x faster than zstd while having roughly the same compression ratio and compression speed. Especially the latter misa77 suffers on, e.g. zstd -2 compresses at 350 MB/s on lzbench on AMD (https://inikep.github.io/lzbench/), while misa77 sits at ~10 MB/s for a similar rate.

    My reference implementation is also written in (almost entirely safe) Rust, which I honestly think is a table-stakes requirement for a new compression algorithm anno 2026. With all the recent attacks on insecure compression implementations I think introducing a new compression algorithm written in a memory-unsafe language is a non-starter.

    Hoping to have a release-ready version at the end of December, when I have some more time to polish it.

    Replies (8)
    1. The lzbench table is several months old at this point, and only has results for misa77 0.6.0, which didn't have any entropy coded levels. I do agree with the broader point of there not being a fast compression level for misa at the middle of the ratio spectrum for now.

      On safety, I'm a bit mixed. I think the format is simple enough right now, that the codebase (especially the decompressor, which compiles to a pretty small .text section, or uses an even smaller asm kernel) can be kept tight enough to avoid the kinds of vulnerabilities that have been popping up in the large codebases of established codecs recently. I've also subjected it to quite a bit of fuzzing and several rounds of review (alongside setting an army of agents loose on it to try and break things, which is how many of the vuls in the other codecs were found).

      All the best for your release!

    2. Ha this is ironic, I'm also doing the same but going for the hard problems, like compressing lossy using lossless.

      It's a fools errand but I've a novel algorithm I had an idea for and wanted to try it out.

      It beats zip level 9 by at least 60% on all but two lossless tests, XML and nci, but it's catching up, and doesn't overfit.

      So far MP3 compression is typically 0.6 to 4% over zip9, typically it achieves this compression _and_ decompression with around the same or faster performance than zip9.

      If it's a success I'll make it open source.

      Replies (1)
      1. Get a room guys... Seriously, work together :)
        Replies (1)
        1. really interesting comment actually. I bet you the amount of people doing the same is exponential. if everyone pooled their resources, collective brain power, tokens etc in one giant repo for something like this instead of 100 separate projects we might make some major headroom.
          Replies (1)
          1. one good part about doing it in silos is that you get novel ideas in different projects which can then later be put together. if everything was in one project there'd likely be less approaches tried

            we will probably see many new approaches come up in the next year where they get combined and mixed and then something comes on top

    3. Do you mind elaborating on the parts of your rust design which are currently “unsafe”. I just want to better understand why these tradeoffs are being made and what the effects are.
      Replies (1)
      1. There's two parts that still use unsafe right now:

        1. The hash table for finding matches. This is incredibly important for compression performance, and every lookup has the form TABLE[hash & mask]. The mask guarantees it is in-bounds, but Rust doesn't understand this unless you use a compile-time sized TABLE which is a bunch of duplicate codegen. So I made an unsafe wrapper for it that gets initialized with a capacity and a known-good mask. This is really uncontroversial.

        2. The core LZ decompression loop. This is pretty much a worst-case scenario where every single instruction added has a 10-20% performance impact. The LZ loop is a constant chain of the form "copy n bytes from offset i", needs constant bounds checks. We actually do those bounds checks, but amortized (we check e.g. once every 8 iterations that our buffer is large enough for the next 8 iterations, even in the worst case), which due to the dynamic nature of offsets here is not something the compiler understands.

        Replies (1)
        1. Have you considered using tools like Verus [0] or Aeneas [1] to prove some safety properties? Point 1 feels especially doable in Verus.

          [0]: https://verus-lang.github.io/verus/guide/ [1]: https://aeneasverif.github.io

    4. Memory-safety is only part of the issues. What would be nice is to have a proof that basic library routines are correct and the decompression produces the correct results, but such proofs can be made for C code as well.
    5. I agree that a C++ repo makes it a non-starter for me. processing untrusted user input with new C++ code is just not wise

      I've spent too many years writing C++ to confidently say there is no UB even in code that I painstakingly write and review line by line

      with how good AI is at exploiting code, it seems irrational to add another C++ blob to my stack. indeed, I've already reimplemented complex components (a/v decoders) in Rust/Go just for the additional safety

      Replies (2)
      1. I don't see the big problem. once a compression algo is defined in C++ it can be easily ported to different languages like Rust

        C++ is a totally fine reference implementation

        Replies (2)
        1. Agree with C++ being totally fine for the ref implementation. C would be even better.
        2. How come both you and "spongebobstoes" have the same lack of punctuation as well as lack of capitalization at the start of some lines?

          Is Hacker News fake in general?

          Replies (2)
          1. it's not a super uncommon style choice. we're not the same person
          2. you got me...
      2. Finely enough, for me, it's opposite. In the age of AI, looking at untrusted new Rust code is a waste of time.

        Am I holding it wrong???

        Replies (1)
        1. Yes, "written in Rust" and "written with AI" are orthogonal axes.
          Replies (1)
          1. Not anymore if you judge based on the actual corpus of projects here.
            Replies (1)
            1. That's conflating correlation and causation. People do often use AI to write Rust because the extensive static checks let the AIs have a tighter test loop. It's the same reason AIs are good at using Lean. But Rust was widely used for years before this started being a thing and there's no reason to expect a random Rust project is AI slop more than there is for any other mainstream language.
    6. > Rust, which I honestly think is a table-stakes requirement for a new compression algorithm anno 2026

      hear, hear.

    7. Does your compressor also support an external dictionary? How well does it support enumerating standalone decompressable chunks?
    8. I respect your work a lot, but the "it must be in rust or else" logic does not make any sense to me.