Node.js async zstd compression was up to 23x slower — one PR fixes it
DanielLockyer · x · 2026-09-28
Developer Cherry found that Node.js's async zlib.zstdCompress() was 3-5x slower than zstdCompressSync() on the same files — up to 23x (4.5s → 0.19s).
Root cause: the sync version hands zstd the whole input in one ZSTDeend call so zstd infers the input size; the async version writes input and ends the frame in separate calls, so zstd never learns the size and sizes its tables for an unbounded stream.
Fix: PR #66358 defaults pledgedSrcSize to the input's byte length. On 162 production JS/CSS/SVG files (up to 370KB each, Linux x64), async output is now byte-identical to sync, with big speedups: level 9 from 300ms to 113ms, level 12 from 4521ms to 194ms, level 19 from 9696ms to 1474ms. Windows shows the same pattern.
More from coding & agent
- AI-native dev runs dozens of scripts via Claude in terminal, clashing with traditional engineers — sven_ai · 2026-09-28
- Cloudflare's Agents SDK hits 2M weekly downloads — threepointone · 2026-09-28
- Claude Code chains scan-to-DXF, Blender rendering, and a deployed 3D web page — sven_ai · 2026-09-28
- Zig's standard library makes AEGIS crypto library Philbin faster — jedisct1 · 2026-09-28
- Polyphonic's Mnemos memory layer is coming to ChatGPT and Claude apps — RileyRalmuto · 2026-09-28
- Obsidian Starter Kit v5 ships: an AI-ready vault built for Claude Code — dSebastien · 2026-09-28