Zstandard’s manual took 12,350 bytes to send. With the old copy, it took 416
We used zstd 1.6.0 to rebuild its own manual from a patch. The tiny download depends on something the recipient already has: the exact earlier file.
The new Zstandard command-line manual is 29 bytes longer than the previous edition. Sending someone those 29 bytes would be a neat trick, except that the authors also replaced and removed text throughout the file. We gave zstd 1.6.0 both editions to see what it actually needed to send. Compressed on its own, the new manual occupied 12,350 bytes. For a reader who already had the old one, 416 bytes were enough to reconstruct the new text exactly.
The occasion for the test is a small change in Zstandard 1.6.0. The command-line tool now accepts --patch-apply to rebuild a file using a previous version as the reference. Earlier releases could already do this with -d --patch-from. The shorter spelling makes the two halves of the transaction easier to read: one person creates a patch, another applies it. The saving comes from the copy already at the other end.
What went over the wire
We took the Markdown source of the command-line manual from the project’s v1.5.7 tag and its v1.6.0 tag, preserving the original bytes. Of the 712 lines in the new file, a line-by-line comparison matched 686 in sequence with the old one. That makes these manuals a particularly favourable case for a patch. The uncompressed text also gives ordinary compression plenty of repeated words and options to work with.
Both runs used the official 64-bit Windows build of zstd 1.6.0 at compression level 3. In the first, the compressor saw only the new file. In the second, it could look for sequences of bytes in the previous manual and refer back to them. It didn’t need to understand Markdown, tell a heading from a paragraph or know which edits a human would call important. Here are the three commands, with each output written to a separate file:
zstd -3 current.md -o full.zst
zstd -3 --patch-from previous.md current.md -o patch.zst
zstd --patch-apply previous.md patch.zst -o restored.md
The reconstructed file was 34,533 bytes long. Length alone is a weak check: a single substituted letter could keep the count identical. We compared the SHA-256 digest of the reconstruction with that of the tagged new file. They matched. The 416-byte measurement includes the entire patch file on disk and excludes the 34,504-byte reference the recipient needed to supply.
Which download belongs on the update server?
Imagine offering those two downloads to readers. Someone installing the manual for the first time can take the standalone compressed copy and open it immediately. Someone upgrading from the exact v1.5.7 file can take the patch and save 11,934 bytes in transit. A reader who has edited their copy to add notes needs a way back to the full download. Merely seeing “v1.5.7” in the filename tells the updater very little about the bytes inside.
The timing matters to anyone trying the new command. The maintainers released 1.6.0 earlier than planned to deliver fixes, including one addressing a memory disclosure during streaming decompression. Upstream publication and distribution packaging have their own clocks. On November 25, for example, Arch Linux listed 1.6.0-1 in Core-Testing. Checking zstd --version tells you which spelling your installed tool can accept.
These figures describe two neighbouring versions of one small text file. An update that replaces most of its content gives the reference far less to contribute. For this manual, the design decision is easy: offer 416 bytes to readers whose old copy you can identify, and keep the 12,350-byte download for everyone else.