fix(build-native): switch pkg compression from Zstd to Brotli#2382
Merged
Conversation
Zstd was measured (Linux x64, packages/cli, --help) to roughly double peak RSS versus GZip/Brotli/uncompressed (~555 MB vs ~283 MB) and be the slowest to start, consistent with the Windows OOM reports since this repo switched GZip -> Zstd in a563769. Brotli matches baseline memory, starts faster than Zstd, and produces the smallest binary of all four compression modes tested. packages/scanner/bin/build-native is a symlink to this file, so both packages pick up the change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
packages/cli/bin/build-nativeswitched compression fromGZiptoZstdina563769("Migrate to @yao-pkg/pkg 6.20.0 and node 24 for binary builds"), a plausible point where the Windows OOM reports started.packages/scanner/bin/build-nativeis a symlink to the cli script, so it picks up the same change.Benchmark
Built
packages/clifornode22-linux-x64with each@yao-pkg/pkg --compressmode (None,GZip,Brotli,Zstd) and measured--helpstartup (10 trials each, after a warm-up run) and peak RSS via GNUtime -v:Zstd roughly doubles peak memory versus every other mode (including uncompressed) and is also the slowest to start — reproduced consistently across 15+ runs. Brotli produces the smallest binary of all four modes, keeps memory at baseline, and starts faster than Zstd (though ~300ms slower than GZip).
Caveats: measured on Linux x64, not the affected Windows machines (couldn't build/run Windows binaries in the sandbox this was benchmarked in), but the memory blowup lives in pkg's decompression path, which is shared across platforms — only the absolute numbers would be expected to differ.
Change
One-line change:
--compress Zstd→--compress Brotliinpackages/cli/bin/build-native.Test plan
appmap --helpstill works correctly on a built binaryGenerated by Claude Code