Remix.run Logo
▲ orlp 5 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 5 hours ago | parent | next [-]

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 2 hours ago | parent | prev | next [-]

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

▲fpoling 2 hours ago | parent | prev | next [-]

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 2 hours ago | parent | prev | next [-]

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 an hour ago | parent [-]

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.

▲SillyUsername 3 hours ago | parent | prev | next [-]

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 3 hours ago | parent [-]

Get a room guys... Seriously, work together :)

▲benjiro29 4 hours ago | parent | prev [-]

[dead]