Skip to content

perf(wasm): speed up Zstd compression - #251

Open
BridgeAR wants to merge 1 commit into
mainfrom
BridgeAR/2026-09-03-wasm-performance
Open

perf(wasm): speed up Zstd compression#251
BridgeAR wants to merge 1 commit into
mainfrom
BridgeAR/2026-09-03-wasm-performance

Conversation

@BridgeAR

@BridgeAR BridgeAR commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

  • enable simd128 for libdatadog-wasm
  • use -C llvm-args=-inline-threshold=45 while retaining Rust's opt-level = "z"
  • use Binaryen -O3, which produced the smallest compressed candidate in the optimization sweep

Results

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 lint
  • npm test
  • Node 18.20.8 and Node 24.20.0 focused build-script tests

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%.
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Overall package size

Self size: 31.65 MB
Deduped: 31.65 MB
No deduping: 31.65 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------|

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@BridgeAR
BridgeAR marked this pull request as ready for review September 3, 2026 20:32
@BridgeAR
BridgeAR requested review from a team as code owners September 3, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant