perf(wasm): speed up Zstd compression - #251
Open
BridgeAR wants to merge 1 commit into
Open
Conversation
LLVM's min-size profile keeps the inlining threshold too low for the Zstd hot path. Raise only that threshold for libdatadog-wasm, enable SIMD, and use Binaryen -O3 on the resulting module. Node 24.20.0 measured 7.2–20.9% faster compression for 1 MiB inputs and 4.9–13.6% for 4 MiB inputs. Brotli size decreases by 0.07%, while gzip size grows by 0.60%.
Overall package sizeSelf size: 31.65 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------|🤖 This report was automatically generated by heaviest-objects-in-the-universe |
BridgeAR
marked this pull request as ready for review
September 3, 2026 20:32
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
simd128forlibdatadog-wasm-C llvm-args=-inline-threshold=45while retaining Rust'sopt-level = "z"-O3, which produced the smallest compressed candidate in the optimization sweepResults
Node 24.20.0 measured 7.2–20.9% faster Zstd compression for 1 MiB inputs and 4.9–13.6% for 4 MiB inputs. The benchmark used seven interleaved trials after warmup in fresh and reversed orders.
Raw WASM grew 2.47%. Brotli size decreased 0.07%, and gzip size grew 0.60%.
Zstd and DDSketch outputs remained byte-identical. Node 18.20.8 loaded and executed the SIMD build.
Verification
npm run lintnpm test