perf(build): optimize deps but not workspace crates in dev/test#29507
Closed
mohammadfawaz wants to merge 1 commit into
Closed
perf(build): optimize deps but not workspace crates in dev/test#29507mohammadfawaz wants to merge 1 commit into
mohammadfawaz wants to merge 1 commit into
Conversation
Local iteration recompiled Leo's own crates at opt-level 2 on every edit. Drop the workspace crates to opt-level 1 in the dev and test profiles while building all dependencies (notably the large snarkVM tree, which is compiled once and cached) at opt-level 3, so runtime — including snarkVM proving in the test suite — stays fast while incremental rebuilds get much cheaper. Also emit line-tables-only debuginfo for the test profile (enough for file/line in backtraces, far cheaper to generate and link than full debuginfo), and pin the ci profile's dependencies to opt-level 1 so the new dependency optimization does not leak in via `inherits` and slow CI's near-clean builds. Verified with `cargo build -v`: under dev, workspace crates resolve to opt-level 1 and dependencies to opt-level 3; under ci, every crate stays at opt-level 1.
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.
What
Speeds up local build iteration by splitting optimization between Leo's own crates and its dependencies:
dev/testprofiles: workspace crates drop fromopt-level = 2→1(fast incremental rebuilds), while all dependencies build atopt-level = 3via[profile.<p>.package."*"]. snarkVM and friends are compiled once and cached, so runtime — including snarkVM proving in the test suite — stays fast even though our own crates are barely optimized.testprofile now emitsdebug = "line-tables-only"instead of full debuginfo — keeps file/line in backtraces, much cheaper to generate and link.ciprofile pinspackage."*"back toopt-level = 1, so the new dependency optimization does not leak in throughinherits = "test"and slow CI's near-clean builds.Why
The runtime hot path is inside snarkVM, not Leo's passes, so optimizing the workspace at
-O2on every edit cost compile time without buying meaningful runtime. This is the standard "optimize deps, not your code" dev-profile split.Verification
cargo build -vconfirms the resolved flags:leo_span→opt-level=1,fxhash/indexmap→opt-level=3opt-level=1(CI compile time unchanged)Deliberately not in this PR (need benchmarking / sign-off)
rocksfeature off the default/test builds — would remove the RocksDB C++ + bindgen compile (and the CI libclang install) from builds that don't need persistent storage. Biggest cold-build win, but a behavior change.snarkvmreach inparser/ast(they pull the umbrella crate but mostly need the lightersnarkvm-consolesubset they already depend on) — improves build-graph parallelism, but needs an import refactor + verification.lld/mold) via.cargo/config.toml— left as a per-developer opt-in rather than forced repo-wide, since not every machine/CI image ships it..cargo/config.tomlhas a malformedcfg(... not(feature = "noconfig)))(unterminated string) that silently disables itstarget-cpu=nativerule — flagging separately since fixing it changes runtime codegen, not build speed.🤖 Generated with Claude Code