Show HN: misa77 - a codec that decodes 2x faster than LZ4 (at better ratios)

Hacker News Top Tools

Summary

misa77 is a new LZ-based codec that achieves decompression throughput up to 2x faster than LZ4 while also offering better compression ratios. It targets write-once read-many workloads and has constant memory usage.

I&#x27;ve spent the last few months working on this codec.<p>It has the following characteristics:<p><pre><code> - SOTA decompression throughput in its ratio class - Decent ratios (comparable to LZ4 at high effort levels) - Slow compression </code></pre> Most of the gains can be attributed to reducing branches and making decompression very friendly to out-of-order cores, by using a smart format.<p>Results on the tarred Silesia corpus on Intel x86-64 follow:<p><pre><code> codec decode ratio encode misa77 -0 5219 MB&#x2F;s 42.64% 54.5 MB&#x2F;s misa77 -1 4274 MB&#x2F;s 39.65% 51.2 MB&#x2F;s lz4 2505 MB&#x2F;s 47.59% 371 MB&#x2F;s lz4hc -12 2531 MB&#x2F;s 36.45% 7.31 MB&#x2F;s</code></pre>
Original Article
View Cached Full Text

Cached at: 07/15/26, 04:43 PM

welcome-to-the-sunny-side/misa77

Source: https://github.com/welcome-to-the-sunny-side/misa77

misa77 (0.2.0)

misa77 is an LZ-based codec that targets the write-once, read-many niche. In particular, it aims to satisfy the following criteria:

  • Extremely high decompression throughput (single-threaded).
  • Modest compression ratios (it has no entropy backend, so one can obviously not compare it to something like zstd, but LZ4 at high effort levels is a good reference point).
  • Constant memory use, regardless of input size (<= 5 MB across all compression modes, and 0 MB for decompression).

Slow compression is the obvious tradeoff that one makes to achieve the above.

In addition, misa77 has a somewhat synergizing tendency to decompress highly compressed files faster, leading to the following results:

  • It offers particularly high decompression throughput on highly compressible files.
  • Even for moderately compressible files, spending more effort during compression to get a more compressed result leads to better decompression throughput (alongside the natural advantage of better ratios).

This makes high-effort compression particularly attractive for misa77, and inspires some experimental compression modes (refer to src/experimental/) that aim to spend more effort at compression time to produce a compressed stream that is friendlier to the microarchitectures of most CPUs when decompressing said streams.

misa77 also has two compression effort levels as of v0.2.0:

  • level 0: offers better decode throughput, slightly worse ratio, similar encode throughput
  • level 1 (default): offers slightly worse decode throughput, better ratio, similar encode throughput

Documentation

The underlying stream format (used by the library functions) and the container format for .misa77 files (produced by the CLI) can be found in docs/.

Benchmarks

Detailed results are listed ahead, but here’s a terse summary:

  • misa77 lies on the pareto frontier for decompression throughput vs compression ratio on most shapes of data.
  • It very frequently decompresses faster even when competitors have a significantly worse ratio.
  • It is quite slow at compression.

Cross-Platform results for v0.1.0 (across Intel x86-64, AMD x86-64, ARM64) can be found here. Note that these are likely outdated at the time of you reading this.

Some detailed results for Intel x86-64 follow.

Setup:

  • CPU: Intel(R) Core(TM) i7-14650HX (@2.2 GHz) (Intel Turbo disabled).
  • Single threaded, pinned to a single performance core.
  • CPU governor set to performance.
  • The benchmarking harness is a public fork of lzbench, and can be accessed here.

Results for the Silesia Corpus.

misa77 rows first, then competitors are sorted by decompression speed.

Compressor nameCompressionDecompress.RatioFilename
misa77 0.2.0 -054.5 MB/s5219 MB/s42.64silesia.tar
misa77 0.2.0 -151.2 MB/s4274 MB/s39.65silesia.tar
zxc 0.12.0 -3115 MB/s2841 MB/s45.46silesia.tar
zxc 0.12.0 -480.8 MB/s2726 MB/s42.63silesia.tar
lzsse8fast 2019-04-18183 MB/s2661 MB/s44.80silesia.tar
zxc 0.12.0 -548.6 MB/s2599 MB/s40.25silesia.tar
lz4hc 1.10.0 -127.31 MB/s2531 MB/s36.45silesia.tar
lzsse4fast 2019-04-18186 MB/s2522 MB/s45.26silesia.tar
lz4 1.10.0371 MB/s2505 MB/s47.59silesia.tar
lizard 2.1 -10320 MB/s2452 MB/s48.79silesia.tar
zstd 1.5.7 -1297 MB/s901 MB/s34.54silesia.tar
snappy 1.2.2375 MB/s855 MB/s47.89silesia.tar

Results for enwik8.

Compressor nameCompressionDecompress.RatioFilename
misa77 0.2.0 -038.7 MB/s4802 MB/s48.59enwik8
misa77 0.2.0 -140.6 MB/s4134 MB/s44.05enwik8
zxc 0.12.0 -370.1 MB/s2674 MB/s52.05enwik8
zxc 0.12.0 -538.7 MB/s2627 MB/s46.85enwik8
zxc 0.12.0 -452.7 MB/s2593 MB/s48.60enwik8
lzsse4fast 2019-04-18141 MB/s2581 MB/s47.11enwik8
lzsse8fast 2019-04-18135 MB/s2553 MB/s47.25enwik8
lizard 2.1 -10240 MB/s2462 MB/s57.31enwik8
lz4 1.10.0276 MB/s2355 MB/s57.26enwik8
lz4hc 1.10.0 -129.89 MB/s2167 MB/s41.91enwik8
zstd 1.5.7 -1225 MB/s831 MB/s40.66enwik8
snappy 1.2.2240 MB/s568 MB/s55.93enwik8

As misa77’s performance is quite “spiky” (depending on the shape of the data being compressed), a file-level breakdown for the silesia corpus yields some interesting insights into its performance.

Note:

Decode speed relative to lz4

At level 0, misa77 decodes faster than lz4 on all 12 files (some by huge margins). All other levels decode faster on 11/12 files. The exception is x-ray, which is highly incompressible (lz4 has a ratio of nearly 1.0 on this file and essentially devolves to a memcpy).

misa77 per-file decode speed vs lz4, all four modes, Silesia (Intel)

Throughput vs ratio, against popular fast-decode codecs

On the compressible files, misa77 sits on the decode-throughput/ratio Pareto frontier: it decodes fastest while ~matching or beating the ratio of the other fast-LZ codecs. sao and x-ray are exceptions due to the reasons stated before.

misa77 vs other codecs: per-file decode throughput vs ratio, Silesia (Intel)

Requirements

  • A C++20 compiler (both GCC and Clang are fine).
  • CMake >= 3.20.
  • A little-endian 64-bit system.
  • The misa CLI needs POSIX (Linux, macOS).

Note: On x86-64, AVX2/SSE2 are selected at runtime. Other architectures use a portable path that has no explicit intrinsics, but is easily auto-vectorizable by compilers (and from my testing, does auto-vectorize on Apple ARM at the very least).

Building

cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

This produces the misa CLI at build/misa. For a binary tuned to the exact machine you’ll run it on, add -DMISA77_MARCH=native (I recommend this). To run the round-trip test:

ctest --test-dir build

CLI Usage

misa is a single, dependency-free binary with three file-based subcommands. It operates on single files only (there’s no directory or pipe support, so tar first if you need those).

misa compress   FILE          # -> FILE.misa77
misa decompress FILE.misa77   # -> FILE
misa suggest    FILE          # -> FILE.misap  (tuned params)

misa compress takes -l N / --level N to pick the compression level (default is 1).

There are also some experimental compression modes (at most one at a time, not combinable with --level):

FlagEffect
--adaptiveautotune the compressor based on the input for decode speed (only use this with homogeneous data)
--params F.misapcompress with a vector from misa suggest
--yolohigh-effort, decode-optimized

--adaptive and suggest also take --tune loose / --tune tight (similar tradeoffs as level 0/1, and the default is loose) and --sample MB (how much input to sample when picking params, default is 2 MB). Everywhere, -o PATH sets the output path and -f overwrites without asking.

misa compress -l 0 enwik8                # enwik8 -> enwik8.misa77, fastest-decode level
misa decompress enwik8.misa77            # back to enwik8

# tune on a sample, then reuse the params:
misa suggest --tune tight data.bin       # -> data.misap
misa compress --params data.misap data.bin

Status

  1. misa77’s format may change unexpectedly as it’s still v0.x.y.
  2. The decoder assumes that the input is a valid misa77 stream. Invalid input is UB and I offer no guarantees for whatever misa77 does in this case.
  3. It’s been through some local fuzzing but is not hardened, so treat it as experimental.

Note: misa77 has evolved out of a less polished endeavour to learn performance engineering, and its history can be found in this archived repository.

Acknowledgement

Inspiration has been taken from:

Lastly, Claude Opus 4.8 and Fable 5 helped a lot with scripting, tooling, and building the CLI.

License

MIT (see LICENSE).

Similar Articles

ZXC: Lossless compression built for ultra-fast decode

Lobsters Hottest

ZXC 0.15.0 正式发布,这是一款面向“一次压缩、多次解压”场景的无损压缩库 libzxc,采用 C 编写,解压速度可达每秒数 GB,其各级别的解码速度均为 LZ4 的 1.5–2.8 倍,且输出体积相等或更小。

OpenZL

Lobsters Hottest

OpenZL is a compression library that generates specialized compressors for specific data formats, achieving high compression ratios at high speeds suitable for datacenter workloads like AI processing.

AdaCodec: A Predictive Visual Code for Video MLLMs

Hugging Face Daily Papers

AdaCodec reduces video encoding redundancy in multimodal LLMs by transmitting full visual tokens only when scene prediction fails, otherwise using compact inter-frame change descriptions. It outperforms per-frame RGB baselines at matched token budgets and achieves better or comparable results with significantly fewer tokens, reducing time-to-first-token from 9.26s to 1.62s.