Release: develop -> main - #139
Merged
Merged
Conversation
* perf(build): tune release profile + adopt mimalloc on the node binary Cargo's default release profile uses `codegen-units = 16` and `lto = false`. For a binary whose wall-clock is dominated by Plonky2 prove calls (3-15 min at MAX_IN_COINS=8) those defaults leave intra-crate inlining on the table at the `node` / `script-plonky2` boundary that calls into `plonky2_field`'s heavily-inlined hot path through a trait surface. - `lto = "thin"` enables cross-crate inlining without the full link- time cost of `lto = "fat"` (upstream Plonky2 tried fat and reverted in their Cargo.toml — see the inline comment). - `codegen-units = 1` forces the whole binary into a single LLVM compilation unit so the inliner sees everything at once. - `incremental = false` is the cargo default for release, restated here so a future `CARGO_INCREMENTAL=1` on a build host cannot silently fragment the codegen unit. - `panic = "abort"` is intentionally not set: `main.rs` installs a global panic hook (PR #36, MINTING_ADDRESS bootstrap recovery) and state / account layers use RwLock poison recovery to fail one request without taking the process down. Abort defeats both. mimalloc replaces the system allocator in the binary only — library crates, integration tests, and program/prover crates keep the system allocator. The Plonky2 prove path allocates many polynomial and witness buffers across the rayon worker pool; glibc-malloc on the debian-bookworm-slim runtime image is not tuned for that pattern. Scoping the swap to `main.rs` keeps unit-test behaviour identical to CI and avoids pulling a C build dependency into every test target. Local release build: 1m 57s on M3 Ultra (vs ~1m 26s pre-change), within the ~5 min CI budget documented in README.md / CONTRIBUTING.md. Pre-push hook (fmt + 3x clippy + workspace check) clean. Expected proof-time impact is modest (single-digit-to-low-double-digit percent on aggregate). The authoritative measurement is the pending R2 wall-clock probe on the M3 Ultra (ROADMAP § Step 9) — this PR makes the build profile what that measurement should be taken from, not a separate one-off tune. * docs(node): correct mimalloc default-features comment The previous comment claimed `default-features = false` strips "secure-mode overhead" and "debug rings". Upstream `purpleprotocol/mimalloc_rust` ships `default = []`, so there are no default features to disable — the original justification was fictitious. Reword the comment to state the real reason: it is a defensive opt-in posture so a future upstream change that turns on `secure`, `debug`, `extended`, or `v2` via default features cannot silently land in the node binary without an explicit code change. No behavioural 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.
Automatic Release PR
Commits: 1 new commit(s)