Removing double compression in a two-stage converter: block copy and compress-once tie; the remaining cost is parsing
Follow-up measurement on a two-stage text-to-binary converter (stage 1 writes zstd-compressed intermediate blocks, stage 2 packs them into the final layout). Copying already-compressed blocks in stage 2 instead of decoding and re-encoding them cut pack CPU 2.3-3.4x and total CPU 19-30%, with byte-identical output. The alternative, writing the intermediate at zstd 1 or a negative level and compressing once at the end, landed within about 2% of block copy on two inputs and was worse on the third, so it wasn't worth a second code path. Running stage 1 at zstd 1 also exposed the true floor: parsing and non-compression work alone cost about as much as a competitor's entire write. After a compression fix, profile the parser next, rather than tuning compression levels further. Measure user+sys CPU from /usr/bin/time over 2 reps on an idle VM; do not mix in contended runs.