Show HN: LZ0 -An asymmetric LZ compressor with ultra minimal, 0-alloc decoder gi...

@best

Show HN: LZ0 -An asymmetric LZ compressor with ultra minimal, 0-alloc decoder github.com · 12 points · 4 comments · HN thread

TL;DR LZ0 is an experimental lossless LZ compression format and C implementation by seb3773, built so that the encoder does most of the work and the decoder stays tiny and allocation-free. The author claims ratios near ZX0 and UPKR on many files, compression in seconds rather than minutes, and decoding at hundreds of MB/s, with several hand-written assembly decoders for x86-64, ARM64 and RISC-V.

  • Design goal: move complexity from decoder to encoder; the decoder uses no malloc, keeps minimal state (out_pos, last_offset, bitreader) and writes only into caller buffers.
  • Bitstream uses MSB-first control bits, four token types (LiteralRun, MatchLast, MatchNew, EOF), Elias gamma integers and a raw offset low byte; the format is specified in docs/LZ0_FORMAT.md.
  • Encoder H2C8 combines a 3-byte hash chain, an O(N) SA-IS suffix array and a sparse dynamic-programming parser that keeps only K=2 Pareto states per position at default level.
  • Reported results: on a 1 MiB text file, LZ0 -6 gives about 38% versus LZ4's 61% and UPKR's 32%; decompression is claimed at 400 to 1,355 MB/s with the FAST x86-64 assembly decoder.
  • Compression of pre-compressed media (JPEG, MP3) is said to avoid inflation thanks to a strict length-2 match filter; the author reports bit-exact round trips and guard-page and fuzz testing.
  • The author's own benchmarks are in-repo and compare against ZX0, UPKR and LZ4 but not against lz4hc -9, which a commenter requested.

Discussion The thread is short, with four comments. The top comment asks for benchmarks against lz4hc -9, which the commenter considers LZ4's closest competitor. The author replies with a long self-description covering the design, claimed ratios and speeds, the three decoder variants, and a request for feedback on the bitstream and edge cases. A skeptical comment asks whether the documentation was written by AI without editing; a reply notes that the README mixes English and French and suggests the author uses French and an LLM for drafting. The mood is mostly neutral and technical, with a note of suspicion about the presentation.

  • Benchmarks against lz4hc -9 are needed (a few): A commenter asks for a comparison with lz4hc -9, arguing it is the nearest competitor on both compression and decompression speed. The current published tables compare with default LZ4 only.
  • Documentation may be unedited AI-generated text (a few): One commenter questions whether the documentation was produced by an LLM without editing. A reply observes that the README mixes English and French, and suggests the author drafts in French and uses an LLM to translate.
  • Author invites technical feedback on format and decoders (a few): The author posts a detailed explanation and asks for feedback on the bitstream layout, decoder trade-offs and edge cases, presenting the project as an experiment rather than a finished product.

Links from the comments

#compression #LZ77 #embeddedSystems #assemblyDecoder #showHN