Re:Show HN: misa77 - a codec that decodes 2x faster than LZ4...
by sroussey on Wednesday July 15, 2026 @02:53PM
(#48925446)
How much of the speed-up is attributed to not hardening the code?
And i do not mean this in a flippant way, as how to harden with speed in mind might alter how to design the format and the codec.
Re:Show HN: misa77 - a codec that decodes 2x faster than LZ4...
by nonadhocproblem on Wednesday July 15, 2026 @02:58PM
(#48925519)
Almost none. Once again, simplicity comes to our rescue here. The decompressor is simple and a naive safe version I implemented but haven't merged into main yet (see: https://encode.su/threads/4514-misa77-ridiculously-fast-deco...) is only ~5% slower than the current unsafe version (and can very likely be made faster).
Re:Show HN: misa77 - a codec that decodes 2x faster than LZ4...
by edflsafoiewq on Wednesday July 15, 2026 @03:14PM
(#48925738)
What's the advantage of the separate streams? That presumably prevents a streaming encoder/decoder.
Re:Show HN: misa77 - a codec that decodes 2x faster than LZ4...
by nonadhocproblem on Wednesday July 15, 2026 @03:29PM
(#48925898)
Yes, that prevents streaming for now.
What is the advantage of this? Out-of-order execution (see my decoder's hot loop: https://github.com/welcome-to-the-sunny-side/misa77/blob/3a9...).
In particular, on even moderately compressible data most blocks take the following form:
- 1 token byte + 2 distance bytes
- a somewhat unpredictable number of literal bytes
If these streams are interleaved, then it's harder for the out-of-order core to process the token bytes of several blocks in advance (as the position of the next token byte depends on the unpredictable number of literal bytes in the current block). However, if you separate them (all token bytes in a prefix, and literal bytes in a suffix), the CPU can speculatively parse token bytes of a lot of blocks in advance (as most of the time, it just has to step forward by three bytes to go to the next block's token byte).
Re:Show HN: misa77 - a codec that decodes 2x faster than LZ4...
by derf_ on Wednesday July 15, 2026 @05:56PM
(#48927587)
I used the same "separate stream" design (one of them coded backwards from the end, to eliminate the need to send a separate offset) when working on video compression, to separate out arithmetic-coded bits from literal bits. It's a good idea. The only reason it isn't in AV1 is because hardware wanted to do DRM decryption in order.
Some concrete changes in the format are:
Now, this format allows our decompressor's hot loop to be very simple (in terms of the number of branches it has). This simplicity in turn allows our compressor to create a compressed stream that is friendly to the (small number of) branches in the decompressor.The experimental compression modes (see readme) attempt to exploit this even further (but are even slower at compression). I define a "cost", which is a linear function of the branches induced by a compressed stream (this function serves as a proxy for decompression time), and then do a DP to minimise this cost.