Repository navigation
perf(wasm-sdk): speed up release WASM optimization - #5147
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Repository: dashpay/platform/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🕓 Review not started yet because this PR is a draft.
Commit 2806459. Normal review starts when eligible; priority review starts as soon as a slot is available. |
| SPEC.loader.exec_module(MODULE) | ||
|
|
||
|
|
||
| class NpmBuildBudgetTests(unittest.TestCase): |
There was a problem hiding this comment.
remove this; we don't need tests for a simple build script
Replace the Python launcher and its tests with a few lines in the existing build step: cap BINARYEN_CORES at min(nproc, cgroup v2 cpu.max quota), keep any runner-provided value, log it, and time `yarn build` with the exit status preserved. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Four optimizer threads were measured ~3x faster than a host-sized pool with byte-identical output, which makes cgroup quota detection unnecessary. A runner-provided BINARYEN_CORES still takes precedence. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The full-optimization recipe ran -Oz four times with --converge, --flatten/--rereloop and extra passes, and first probed 14 optional flags by optimizing the entire module once per flag. On wasm-sdk this took over an hour with a host-sized thread pool (16m41s at four threads). One standard -Oz pass with the same features and producer stripping takes 2m18s for +2.0% raw / +0.35% gzip size. Minimal (-O2) and no-optimization builds and the wasm-sdk optimized.wasm copy are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Issue being fixed or feature implemented
The NPM release build is dominated by Binaryen. In the baseline job,
yarn buildtook 87m24s, of which wasm-sdk optimization took 70m41s. There were two causes:fullrecipe inbuild-wasm.shran-Ozfour times with--converge,--flatten/--rereloopand extra passes. It first probed 14 optional flags by optimizing the entire module once per flag.This consolidates #5152 into this PR.
What was done?
BINARYEN_CORES, which a runner-provided value overrides). Cargo's job budget is unchanged. The step logs the thread count and timesyarn build.-Ozpass forfulloptimization, keeping producer stripping and the same enabled WASM features. Minimal (-O2), no-optimization and the wasm-sdkoptimized.wasmcopy are unchanged.No Rust source, dependency, Cargo profile or binding changes.
Measurements (from #5152)
Same 47,166,333-byte pre-optimization wasm-sdk module, Binaryen 121, 20-CPU/32 GiB container:
-Oz, 4 threadsThe single pass costs +2.0% raw / +0.35% gzip (~28 KB compressed). The optional
-tnh(traps-never-happen) pass is no longer applied. A cold fullyarn buildon the self-hosted runner completed in 8m01s (single run, build stage only). The previous build's 441 SDK Node tests passed on both optimizer outputs, with identical WASM imports/exports.How Has This Been Tested?
.github/scripts/testssuite pass.build-wasm.sh:optimized.wasmcopy, minimal/none modes, missingwasm-opt, and optimizer failure propagation.-Ozpass. Four threads was measured with the original recipe; it has not been re-tuned for the single pass.Breaking Changes
None. Released WASM bytes change (slightly larger) because of the optimizer recipe.
Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
PR Hygiene ·
2806459/skip-botsproceeds without the ones not yet reported/self-reviewed.github/actions/npm-release-build/action.yaml,packages/scripts/build-wasm.sh) — QuantumExplorer or shumkovWhen every box is checked the
PR Hygienecheck passes and this can merge.