nattviken

17 November 2026

hZ: from idea to public benchmark report in two days

It started with a simple irritation: the archive script ran tar | zstd -3 and I knew it was wasteful. Two days later there is hZ — public, measured and documented. This is the kind of project I call a vibe project: you start with a feeling and end with a binary.

A few things I take with me:

Measure before you believe. Three times during the build, the measurement showed the opposite of intuition. PNG images that deflate had already squeezed 50:1 gained the most from being unpacked — the win was in the similarities between the images, not within them. "Already compressed can't be compressed" cost 175 MiB before the assumption was replaced by a test. And when hZ lost to zstd on archives-of-archives, it was not the architecture that failed but the sample: 4 MiB scattered around cannot see that two files hundreds of megabytes apart are nearly identical.

The GPU solved the wrong problem. A whole track was built with Vulkan compute: LZ77 matching became 2.5× faster on the graphics card. Packing did not get faster at all — entropy coding is serial, and Amdahl always wins. The track stays in the repo as a measuring instrument, not as a production path. That is a result too.

Fork in threaded programs is a trap with three false bottoms. A malloc between fork and exec hung workers for 84 minutes. Pipes inherited between parallel children produced an EOF that never came. And the Python registry's hash prefix was 8 bytes where the C++ side read 16. All three are now in the report, because they are general.

The next note from the workshop will probably be about GIF — the format is LZW from 1987 and is waiting for the same treatment JPEG got.

← All field notes