Menu

LZ encoder 25 -> 575 MB/s: what broke when I took the lz4 trick into a format with min distance 64
📰

LZ encoder 25 -> 575 MB/s: what broke when I took the lz4 trick into a format with min distance 64

DEV Community: cpp·contour·about 1 month ago
#WxXgGITG
#devtocpp#devto#dev#match#lzbench
Long article (593 words) — no AI summary yet.
Reading 0:00
15s threshold

ACEAPEX has a fast profile (levels 11-18). Fixed 32-bit tokens, min match 16, min distance 64, independent 1 MiB blocks. The point of it is decode: no length branches, 64 literal and 96 match bytes copied per token.

Decode was fine. Encode was not. Level 11 did silesia at 25.8 MB/s. zxc -1 does the same file at ~1 GB/s. In lzbench that is the first thing people see.

So I took the obvious thing: lz4 fast. One slot per hash, step grows on misses. Result 65.16 % at 406 MB/s. Fast, but ratio fell apart. Below is where exactly it broke and what was built on top.

where the lz4 trick breaks on this format

min distance 64. On runs and short periods the slot holds a position 1..63 bytes back. Format can not encode it. Match lost.

min match 16. A probe lands in the middle of a match. lz4 starts the match at the probe, so the first part goes out as literals.

insert only probed positions. Table is too sparse, long matches are missed between probes.

what was built

8-byte hash key.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.