19 comments

  • orlp 4 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 4 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 1 hour 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

    • fpoling 1 hour 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 1 hour 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 36 minutes 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.

    • SillyUsername 2 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 2 hours ago
        Get a room guys... Seriously, work together :)
    • benjiro29 3 hours ago
      [dead]
  • zX41ZdbW 5 minutes ago
  • weitendorf 4 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 3 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 2 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 2 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 2 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

    • fullstop 2 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 2 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 :)

  • powturbo 3 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

  • iagiagiag 1 hour 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 4 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 2 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 4 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.

  • ramon156 38 minutes ago
    See, this is good use of AI. all i could spot was a benchmark done by an LLM. This is verify-able and the readme was clear. What a breath of fresh air..
  • numericOverflow 2 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 2 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
  • user20180120 3 hours ago
    How does it compare with lrzip ? lrzip is very fast at decompression - bottleneck is the I/O of where you are decompressing to.
  • Someone 4 hours ago
    So, is the speedup specific to the compression format or can (parts of) it applied to the zstd code base, too? If so, how much would that speed up zstd? At what cost (CPU load, memory usage)?
    • nonadhocproblem 4 hours ago
      It uses a different compression format from zstd, and I suspect that most of the speedups won't cleanly transfer. Broadly speaking, the speedup can be attributed to the format being much friendlier to properties of modern cores that older codecs probably didn't plan for (strong OoO execution, big ROBs and caches, etc).
  • mgaunard 22 minutes ago
    so many rust fanboys in this thread.

    Guaranteeing memory safety isn't that useful; guaranteeing correctness is. And no language gives you that.

  • atiedebee 3 hours ago
    Very cool project, I wonder why levels 4 and 5 decompress slower than 3 and 6?
  • jauntywundrkind 4 hours ago
    Openzl by the zstd author also speeding up. https://www.phoronix.com/news/OpenZL-0.3-Released

    Zxc has similar compression but very fast. https://github.com/hellobertrand/zxc

    Couple others out there too!

    • nonadhocproblem 4 hours ago
      Comparisons against zxc have been included in the README.

      At the higher compression end (levels 11-13), minlz is the most relevant competitor. https://github.com/minio/minlz

    • andrepd 3 hours ago
      Openzl is not a set and forget tool, it's more of a tool factory. You need to feed it a schema to generate a compressor tailored to that schema, which is just not applicable to many types of data.
  • jmakov 4 hours ago
    Should probably include PCodec when comparing to others.
  • prymitive 3 hours ago
    > write-once, read-many niche

    Is that really a niche?

    • nonadhocproblem 2 hours ago
      I do think it's a niche as the most popular use case is likely for game assets, where a closed source codec called Oodle (owned by epic games) has reigned supreme for a decade, and there has been little effort in trying to achieve open-source parity with its performance.

      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.

    • poly2it 2 hours ago
      Server-rendered content is often write-many, if you consider writing mostly similar data multiple times to be "many".
  • benchleo 1 hour ago
    [dead]
  • felixmarlowe 1 hour ago
    [dead]
  • djawlagml 3 hours ago
    [dead]
  • VeejayRampay 5 hours ago
    the usual caveat being that this is a project by one dev with a few hundred stars, as opposed to a big project with immense adoption and recognition, backed by a big organization and tons of maintainers.

    still, good for the author trying to challenge the status quo and best of luck on the long run.

    • garganzol 4 hours ago
      Judging by optics and not by essence is a great way to cultivate illusion.
      • CableNinja 19 minutes ago
        Id even argue that this is kind of thinking (parent comment, not yours) is a great way to keep the status quo, which is currently hot garbage, and stiffle innovation.

        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 3 hours ago
        You are correct, but I think in exactly the opposite of the way you intended. "Optics" are some person parroting their LLM's ridiculous claim to have improved battle-tested software by 3x with a prompt. "Essence" is actual software used by millions of people in production workloads, working successfully in all manner of environments. Clickbait headlines are optics, not essence.
        • nonadhocproblem 3 hours ago
          It might do you some good to have an object-level understanding of claims before opining on them. Especially in a field like compression, where most claims are easily falsifiable.
          • Someone 3 hours ago
            But the most important one often is implicit and harder to falsify: that a compress-decompress cycle will round-trip for every possible input and compression setting.

            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 2 hours ago
              I agree but this feels like a bit of a red herring since we're talking about performance here. Imagine trying to design a compression algorithm that's "maximally bad" in this sense. That is, it is extremely performant and correct on most data (it roundtrips), but there's some class of data for which it fails (decompression doesn't produce the original bytes), and fixing the algorithm just for this class of data takes away its performance advantages on most classes of data. In practice, this seems quite hard/weird to do.

              Although relatedly, it's definitely possible for claims on performance (instead of correctness) to only hold on certain classes of data.