Hacker News
Show HN: misa77 – Up to 3x faster decompression than zstd, with better ratios
orlp
|next
[-]
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
|root
|parent
|next
[-]
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
|root
|parent
|next
|previous
[-]
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
fpoling
|root
|parent
|next
|previous
[-]
cheney_2004
|root
|parent
|next
|previous
[-]
orlp
|root
|parent
[-]
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.
SillyUsername
|root
|parent
|next
|previous
[-]
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.
weitendorf
|next
|previous
[-]
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
|root
|parent
|next
[-]
Compilers are pretty good at optimally scheduling instructions for different CPU architectures, so using assembler directly is counterproductive.
weitendorf
|root
|parent
[-]
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
|root
|parent
[-]
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
|root
|parent
[-]
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
fullstop
|root
|parent
|previous
[-]
weitendorf
|root
|parent
[-]
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 :)
powturbo
|next
|previous
[-]
mis77, zxc, zstd, minlz, ...
TurboBench Compression Benchmark : https://github.com/powturbo/TurboBench
iagiagiag
|next
|previous
[-]
icauroboros
|next
|previous
[-]
user20180120
|root
|parent
|next
[-]
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
nonadhocproblem
|root
|parent
|previous
[-]
It should still give you LZ4-class ratios with much faster decode than LZ4 though.
ramon156
|next
|previous
[-]
numericOverflow
|next
|previous
[-]
So what is your observed compression speed penalty vs benchmarks? This is understandable, but please show your counterbalance to achieve these decomp benefits.
nonadhocproblem
|root
|parent
[-]
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
user20180120
|next
|previous
[-]
Someone
|next
|previous
[-]
nonadhocproblem
|root
|parent
[-]
atiedebee
|root
|parent
[-]
mgaunard
|next
|previous
[-]
Guaranteeing memory safety isn't that useful; guaranteeing correctness is. And no language gives you that.
atiedebee
|next
|previous
[-]
jauntywundrkind
|next
|previous
[-]
Zxc has similar compression but very fast. https://github.com/hellobertrand/zxc
Couple others out there too!
nonadhocproblem
|root
|parent
|next
[-]
At the higher compression end (levels 11-13), minlz is the most relevant competitor. https://github.com/minio/minlz
prymitive
|next
|previous
[-]
Is that really a niche?
nonadhocproblem
|root
|parent
|next
[-]
I would publish benchmarks against oodle, but their licensing is quite unclear about whether this is allowed, and I don't want to take risks for no reason.
VeejayRampay
|previous
[-]
still, good for the author trying to challenge the status quo and best of luck on the long run.
garganzol
|root
|parent
[-]
CableNinja
|root
|parent
|next
[-]
The whole of computing is a shitter of layers and layers of going with what the last guy did. I may or may not use misa77, but i applaud the effort and attempt at innovation.
anonymous908213
|root
|parent
|previous
[-]
nonadhocproblem
|root
|parent
[-]
Someone
|root
|parent
[-]
Having said that this repo has fairly extensive tests for that. See https://github.com/welcome-to-the-sunny-side/misa77/blob/mai.... I couldn’t find them covering all settings, but that may be just me not looking hard enough, and even if they don’t, adding that is easy.
nonadhocproblem
|root
|parent
[-]
Although relatedly, it's definitely possible for claims on performance (instead of correctness) to only hold on certain classes of data.