Better HN
topnewbestaskshowjobs
Log inSign up

seb3773

18 karma · joined Jan 3, 2026 (10mo ago) · 23 submissions

Submissions

comment 5d ago · link · parent

https://github.com/seb3773/lz0/discussions

comment 5d ago · link · parent

yes, fixed and will remain stable.

comment 5d ago · link · parent

For any further questions, please use the GitHub issues.

Since roughly half of my replies here get flagged in seconds for no valid reason (they are technical, neutral, and certainly not ai generated slop), I'm stopping all communication in this thread. It's simply frustrating and pointless.

comment 5d ago · link · parent

just in case my previous reply isn't visible to everyone: I did respond to your message, but it seems HN's moderation system flagged my comment (and 2 other answers I did to other questions), not that I did not want to respond

comment 6d ago · link · parent

I've just updated the readme with the exact measured numbers, thanks for pointing it out (this ~200 bytes remark was an outdated note in the readme from a first unrolled loop prototype)

comment 6d ago · link · parent

You're right : a minimalist LZ4 decoder can be written in ~150-200 bytes of assembly or even ~35 lines of C because it doesn't have to handle a bitstream. However, LZ0's compact decoders are exactly the same size: lz0dec_x86_64.s: 184 bytes lz0dec_arm64.s: 180 bytes (pure leaf, 0 bytes of stack) lz0dec_riscv64.s: 160 bytes (pure leaf, 0 bytes of stack) lz0dec_min.c: 47 lines of C, 0 allocations, 0 libc

So LZ0 offers the same decoder compactness as a minimal LZ4 decoder, but for an Elias gamma bitstream with arbitrary window.

comment 6d ago · link · parent

Well, the fact is that in the LZ4 bitstream, offsets are hard-coded as 16-bit integers (2-byte uint16_t). It is physically impossible for LZ4 to reference a byte located more than 65,535 bytes back. So, on a 1.3 MB binary (bash_x86_64 for example) or a 5 MB blob, LZ4 is blind to long-range repetitions. On blob_png_5m.bin, LZ0 Ultra beats LZ4HC by 830 KB because LZ0 can reference chunks of duplicated image data located several megabytes apart. Furthermore, in LZ4, every token costs 1 byte, every offset costs a full 2 bytes, and every length extension costs 1 extra byte. In contrast, in LZ0, the Literal vs Match decision takes a single bit. Reusing the same offset costs only 1 bit plus the Elias-encoded length. Offsets are encoded with Elias gamma + 7 trailing LSB bits, and reusing a recent offset often costs 4 to 8 bits total in LZ0, versus a minimum of 24 bits in LZ4. Also, LZ4 produces some inflation (expansion under 1%, however) on JPG, PNG, or already-compressed data. LZ0 has virtually zero inflation and does not corrupt the ratio on multimedia files. That said, let's not forget that LZ4 decompresses faster than LZ0 (byte-aligned format with no bit shifting). But compared with the dense compressors in its category (ZX0, UPKR, ...), LZ0 offers the density of an optimal unbounded-window compressor while approaching LZ4-class throughput (well, within a factor of 2x to 4x, versus lagging ~30x to 100x for ZX0/UPKR).

comment 6d ago · link · parent

No offence, as you're absolutely right: originally, I wrote this for my own personal needs, mainly for embedding resources into binaries or for use on highly constrained systems. I was simply looking for an alternative to ZX0, which has a very good ratio, a very simple decoder, and good decompression speed. However, its encoding is extremely slow (far too slow for my use cases). There's also UPKR, which achieves even better ratios and has fast encoding, but its decoder is more complex and, above all, quite slow at decompression. My idea was to try to build something offering the density of an optimal unbounded-window compressor while approaching the throughput of LZ4-class codecs (with a 2x to 4x factor, vs 30x to 100x deficit for ZX0/UPKR). I ended up with a (maybe) interesting compromise, and that's why I decided to post it on GitHub and here, thinking this work might serve as inspiration for other developers... I'm doing this in my free time, and while I've put a lot of care into my code, I DID use LLMs to format and write the GitHub documentation, especially since all my notes for this project were pretty chaotic... The result is indeed a bit "AI slop", but as I explained, I didn't think it would interest that many people anyway, so apart from a (too) quick proofread, I honestly didn't carefully revise the README in particular. Sorry about that, I'll try to fix it.

comment 1w ago · link · parent

I built LZ0, an asymmetric LZ compressor targeting environments where decompression resources are tightly constrained (bootloaders, microcontrollers, embedded asset loading) or where decoder simplicity matters most. I've always admired micro-decoders like Einar Saukas' ZX0—zero dynamic allocation, no scratch RAM, and small enough to fit into a handful of instructions. The catch with traditional optimal parsers is that they often scale in O(N^2), taking tens of seconds or minutes once files exceed a few hundred kilobytes. I wrote LZ0 to keep that same decoder footprint while compressing multi-megabyte files in milliseconds.

Where it sits (Ratio vs. Speed): - Compression density: beats LZ4/Snappy, staying within 1–3% of zlib/Deflate and exhaustive ZX0. - Decompression speed: 200–350 MB/s for portable C, 250–700 MB/s for compact ASM, and 520–1,330 MB/s for vector ASM. That's up to 10x faster than Deflate while requiring zero heap memory or state tables. - Compression throughput: ~1.3–1.6 s on typical 1 MB inputs.

How the encoder avoids the O(N^2) wall (H2C8 pipeline): - Multi-tier match finding: dual-level hash chains for local matches paired with an O(N) SA-IS suffix array for deep, long-range matches. - Sparse DP parsing: instead of evaluating every edge in the graph, it groups Elias gamma bit costs into mathematical plateaus to skip redundant searches.

The repo ships with three 0-alloc decoder implementations: 1. Portable C (`lz0dec_min.c`): ~75 lines of freestanding C with zero libc dependencies. 2. Compact ASM: hand-written x86-64 and ARM64 routines (~1.3 KiB of machine code), with zero state or lookup tables. 3. High-throughput "FAST" ASM: dual-engine vector path (SSE2 on x86-64, NEON on ARM64) using branch-free Elias gamma decoding and segment-window refills.

All decoders enforce strict bounds checks and have been validated against 240,000+ guard-page and fuzzing tests to ensure corrupt streams never trigger out-of-bounds reads or crashes.

Bitstream specification: https://github.com/seb3773/lz0/blob/main/docs/LZ0_FORMAT.md Benchmarks: https://github.com/seb3773/lz0/blob/main/docs/BENCHMARKS.md

I'd appreciate any feedback on the bitstream layout, the decoder tradeoffs, or edge cases I might have missed.

10.

Show HN: LZ0 -An asymmetric LZ compressor with ultra minimal, 0-alloc decoder(github.com ↗)

29 points · by seb3773 · 1w ago · 21 comments

11.

Show HN: Native C/C++ FreeArc archiver (no Haskell, no Wine)(github.com ↗)

2 points · by seb3773 · 1mo ago · discuss

comment 7mo ago · link · parent

I've published a detailed RFC for deep NTFS structural repair (addressing B-Tree corruption, $Bitmap inconsistencies, and MFT reconstruction) which is currently missing from existing open-source tools like ntfsprogs.

I used a strict clean-room approach (black-box observation) to ensure the specification is legally safe for open-source implementations. My goal is to provide a solid foundation for anyone wanting to build a real 'chkdsk' equivalent for Linux or ReactOS. The RFC includes a 16-phase repair logic and detailed pseudo-code for complex structures like B-Trees and Journal replaying. Feel free to use the logic or the pseudo-code for your own projects!

13.

Show HN: A Clean Room RFC for NTFS Structural Repair(github.com ↗)

3 points · by seb3773 · 7mo ago · 1 comment

14.

Show HN: ZELF – A modular ELF64 packer with 22 vintage and modern codecs(github.com ↗)

4 points · by seb3773 · 10mo ago · discuss