Top
Best
New

Posted by nonadhocproblem 15 hours ago

Show HN: misa77 – Up to 3x faster decompression than zstd, with better ratios(github.com)
247 points | 81 comments
orlp 12 hours ago|
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.

nonadhocproblem 12 hours ago||
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!

spongebobstoes 9 hours ago|||
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

r_lee 7 hours ago|||
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

paaloeye 7 hours ago|||
Agree with C++ being totally fine for the ref implementation. C would be even better.
uhsiff 2 hours ago|||
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?

spongebobstoes 58 minutes ago|||
it's not a super uncommon style choice. we're not the same person
r_lee 40 minutes ago|||
you got me...
paaloeye 7 hours ago|||
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???

treyd 6 hours ago||
Yes, "written in Rust" and "written with AI" are orthogonal axes.
paaloeye 6 hours ago||
Not anymore if you judge based on the actual corpus of projects here.
treyd 6 hours ago||
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.
p11p 59 minutes ago|||
I respect your work a lot, but the "it must be in rust or else" logic does not make any sense to me.
genxy 1 hour ago|||
Does your compressor also support an external dictionary? How well does it support enumerating standalone decompressable chunks?
fpoling 9 hours ago|||
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.
cheney_2004 9 hours ago|||
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.
orlp 8 hours ago||
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.

GZGavinZhao 3 hours ago||
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

SillyUsername 10 hours ago|||
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.

phacker007 10 hours ago||
Get a room guys... Seriously, work together :)
BorisMelnik 5 hours ago||
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.
r_lee 5 hours ago||
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

pmarreck 6 hours ago|||
> Rust, which I honestly think is a table-stakes requirement for a new compression algorithm anno 2026

hear, hear.

kamalmosadegh69 7 hours ago|||
[dead]
benjiro29 11 hours ago||
[dead]
weitendorf 12 hours ago||
I'm gonna try this later. I just got a 5x (single core, 5MB/s) - 10x (dual core 10MB/s) speedup on brotli in the last few days. It's been really surprising to realize how much storage and traffic bandwidth is going to waste because of unoptimized transit.

brotli -11 is so slow nobody probably uses it right now but at 10x speed it actually becomes pretty ok. It's a more efficient encoding than zstd (and gzip by far) at their max compression settings.

Haven't got a writeup yet but: https://claude.ai/share/0e8bf6c0-6d64-4a34-8f97-37ccbae19732

Brotli/zstd are kind of in a class of their own in my view because of their direct browse integration and support. That's why I focused on brotli specifically. Didn't know so many others on hn were also working on this rn.

I actually just did it in x86_64 but if you start there it's trivial to wrap that in C/Go/etc these days. Here's the Go+C shim: https://claude.ai/share/57ddeb9a-36bf-4690-99d5-621147b15a77

vardump 10 hours ago||
Might have been better to ask Claude to emit C/C++ code with intrinsics (which is actually what Claude did at some point!).

Compilers are pretty good at optimally scheduling instructions for different CPU architectures, so using assembler directly is counterproductive.

weitendorf 10 hours ago|||
I did this about 5x in parallel and I know at least half the attempts actually started with a C sanity check impl first anyway (I guess including this one). I do think you're right that the better order of operations would have been:

  1. establish a true C impl baseline

  2. hillclimb until satisfied

  2.5 establish a more rigorous profiling before/after/baseline and hotpath detection approach

  3. disassemble and strip out unnecessary binary overhead

  4. continue optimizing until satisfied
FOr projects like this where a lot of the iteration is on ASM itself, I do want to challenge one notion though:

  1. compilers are pretty good but they are definitely not perfect

  2. Fable has pretty good judgment when it comes to handrolled impls, in my opinion

  3. hillclimbing performance gains is easily verifiable incrementally on low level code. fablemaxxing asm is basically what this thing was Born To Do

  4. past a certain point the tuned asm surpasses the compiler's output every time.
you're basically just throwing world's most expensive/optimized compiler at it over and over and over until you're ready to call it quits. In other words

> using assembler directly is counterproductive.

I'm not! ain't nobody got time for that. this like the platonic ideal RL task for models to be trained on and they're better than me at it (at very least much more methodical and persistent)

> for different CPU architectures

Similarly, I don't see why I can't just do this independently on every CPU architecture I care about. I've been doing this kind of stuff a lot the past week and it just works tbh. Here's a 64 bit wasm example, I thought it was pretty interesting: https://claude.ai/share/62d4dae5-3cd5-4108-ad68-5e299a691479

vardump 10 hours ago||
Different CPU models have different optimal instruction scheduling. So you'd hillclimb a certain CPU model and perform suboptimally on another.

It's very easy to just let C-compiler do that work and compile the lib statically + LTO (optionally PGO). You'll get all of the benefits you think you're getting from the assembler version. LTO & PGO might even find more optimizations around the compression / decompression calls.

weitendorf 10 hours ago||
right, I'm just saying that for my use case, I'd prefer to just run a specialized tune against each CPU model I use

I think that over time an increasingly large portion of software will be built this way. For this project I'm ok with adding support for each new CPU taking an agent a few hours. If you're implementing against a known standard, until you find a security issue, these don't really ever need to change, which is a very nice property IMO

ozgrakkurt 6 hours ago|||
They are actually not really that good at doing that if you are writing something like a memcopy or compression code using inline-assembly/intrinsics.

Compiler is actaully not really good at that a lot of the time either.

It is good if you don't want to spend too much time on it, but if you have the time and know how to write assembly then there is no comparison.

fullstop 10 hours ago|||
Compression is really cool, and while bandwidth goes to waste without it there are (historically) so many bugs around it. Maybe this will get better with AI hammering at it, but there's so many buffer overflow bugs, chained decompression bugs, DoS attacks, etc. It's surprisingly difficult to get right.
weitendorf 10 hours ago|||
Yeah I find it pretty surprising how "intricate" most of these formats get by basically just stacking heuristics or having completely different impls across compression levels (this is not intuitive to me, I'd have expected more of a gradient or).

Fortunately fuzzing has become really easy now, but this is a very easy target for an attacker to hit with a adversarial payload because it's not cryptographically secure. It's been pretty hit or miss for me whether I can get regular consumer agents to do "content/binary-aware security testing" on this stuff without freaking out.

But this is itself a climbable problem so, I'm sure it's possible to address this. At a cost of $200 per binary :)

ozgrakkurt 6 hours ago|||
How is it possible to hack some code that calls zstd::decompress on a bounded buffer? I am genuinely confused by this, but a lot people wrote this here so I assume there is some problem with it.

Is this kind of like OpenSSL being terrible but the crypto libraries being good?

fullstop 6 hours ago||
The problems are not usually with the compression libraries themselves, but rather the users of the libraries.

Things like MongoBleed (CVE-2025-14847), are what I am thinking of.

ozgrakkurt 3 hours ago||
People going crazy about writing compression libraries in rust are hallucinating then.

I think this is the same in crypto as all crypto primitive libraries are ASM/C and they are really solid compared to something like OpenSSL

ozgrakkurt 6 hours ago||
Wait until you hear about something called JSON.
powturbo 11 hours ago||
Daily Multiplatform benchmarks available at: https://github.com/powturbo/TurboBench/blob/master/turbobenc...

mis77, zxc, zstd, minlz, ...

TurboBench Compression Benchmark : https://github.com/powturbo/TurboBench

zX41ZdbW 7 hours ago||
Tested it on real datasets: https://github.com/ClickHouse/ClickHouse/pull/137004#issueco...
nonadhocproblem 7 hours ago|
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.

stickler-soz 6 hours ago||
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).
powturbo 6 hours ago|||
[dead]
nonadhocproblem 6 hours ago|||
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).

stickler-soz 5 hours ago||
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!
nonadhocproblem 4 hours ago||
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.

xpct 46 minutes ago||
Anyone got any good write-ups on how modern compressors work, or where the speed is coming from?
iagiagiag 9 hours ago||
Thanks for your work. I have an even more specific need which is to compress billions of very small messages (<200 chars). Zstd is currently giving the best results (ratio ~1:3). Can your algorithm handle that well with a dictionary?
icauroboros 12 hours ago||
Interesting, I was looking for something like this about few months ago for my own "write-once, read-many" case optimized delta based store library https://github.com/icauro/Gutch, but there was not much other than lz4 and zstd. I would like to test it, if there are rust bindings for it.
user20180120 10 hours ago||
What data point can you share with us - I would be interested to know more about your usage of lrzip for your particular use case.

Do not do an

apt install lrzip

That will probably give you an older version of lrzip.

Make sure you go and get it from the latest source

https://github.com/ckolivas/lrzip

nonadhocproblem 11 hours ago||
A rust version does exist, but it's based on misa77 0.6.0, which is incompatible with 0.9.0. https://github.com/paddor/m77rip

It should still give you LZ4-class ratios with much faster decode than LZ4 though.

unsigner 1 hour ago||
Very interesting work, thank you!

What are you plans to proclaim 1.0?

muizelaar 1 hour ago||
Can you explain what it does differently to be better?
numericOverflow 10 hours ago|
>Slow compression is the obvious tradeoff that we make to achieve the above.

So what is your observed compression speed penalty vs benchmarks? This is understandable, but please show your counterbalance to achieve these decomp benefits.

nonadhocproblem 10 hours ago|
There are detailed tables in the readme (in spoilers under the charts, so you may have missed them).

I'll post some numbers here anyway. These are on the silesia corpus (text, executables, databases, etc) on the intel setup described in the readme.

Ordered by ratio, encode / decode in MB/s.

                ratio   encode  decode
  misa77 -3     42.59%   71.9    5909
  misa77 -11    27.38%   33.1    2445
  zstd -11      27.35%   26.7     976
  zstd -15      26.83%   6.86     997
  misa77 -12    25.83%   5.81    2496
  zstd -19      24.93%   2.32     870
  misa77 -13    24.82%   1.39    2633
  zstd -22      24.67%   1.51     813
numericOverflow 35 minutes ago||
Ah, thanks. I missed them in spoilers on mobile.
More comments...