Posted by nonadhocproblem 15 hours ago
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.
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!
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
C++ is a totally fine reference implementation
Is Hacker News fake in general?
Am I holding it wrong???
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.
[0]: https://verus-lang.github.io/verus/guide/ [1]: https://aeneasverif.github.io
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.
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
hear, hear.
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
Compilers are pretty good at optimally scheduling instructions for different CPU architectures, so using assembler directly is counterproductive.
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
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.
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
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.
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 :)
Is this kind of like OpenSSL being terrible but the crypto libraries being good?
Things like MongoBleed (CVE-2025-14847), are what I am thinking of.
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
mis77, zxc, zstd, minlz, ...
TurboBench Compression Benchmark : https://github.com/powturbo/TurboBench
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.
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).
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.
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
It should still give you LZ4-class ratios with much faster decode than LZ4 though.
What are you plans to proclaim 1.0?
So what is your observed compression speed penalty vs benchmarks? This is understandable, but please show your counterbalance to achieve these decomp benefits.
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