make graph data lazy for reused binary lists#3132
Draft
cornmander wants to merge 2 commits intonextest-rs:mainfrom
Draft
make graph data lazy for reused binary lists#3132cornmander wants to merge 2 commits intonextest-rs:mainfrom
cornmander wants to merge 2 commits intonextest-rs:mainfrom
Conversation
…-rs#3128) Delay loading the cargo metadata graph until it is actually needed, and let the reused binaries-only list path discover the workspace root without constructing the full package graph up front. This keeps the normal behavior intact while cutting startup cost for list --list-type binaries-only with --binaries-metadata. Also add integration coverage for the reused binaries-only path.
Collapse a nested if in manifest_path_for_build() so the lint job passes on CI.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3132 +/- ##
==========================================
- Coverage 84.43% 0.88% -83.55%
==========================================
Files 156 152 -4
Lines 42733 42009 -724
==========================================
- Hits 36080 371 -35709
- Misses 6653 41638 +34985 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
fixes #3128.
summary
This change delays loading the Cargo package graph until it is actually needed, instead of constructing it in
BaseApp::newunconditionally.For
cargo nextest list --list-type binaries-onlywith reused--binaries-metadata, that means nextest can skipcargo metadataand thePackageGraphin the common fast path, resolve the workspace root withcargo locate-project, and still preserve the existing diagnostics for CLI filter parsing.The normal non-reused list path is not materially changed by this patch.
performance
Benchmarks were run with warm caches on macOS (
aarch64-apple-darwin) usinghyperfine, comparingorigin/mainwith this branch.tokio(e67cd87, 264 binaries):121.6 ms ± 2.3 ms->52.8 ms ± 0.8 msfornextest list --list-type binaries-only --binaries-metadata ... --message-format json.tokio:2.30xfaster, or about56.5%lower wall time.rust-analyzer(51966da, 68 binaries):174.7 ms ± 9.6 ms->57.3 ms ± 1.5 msfor the same command.rust-analyzer:3.05xfaster, or about67.2%lower wall time.The avoided Cargo startup cost lines up with the improvement:
tokio:cargo metadata --format-version=1 --all-features --filter-platform aarch64-apple-darwinwas87.2 ms ± 3.5 ms, whilecargo locate-project --workspace --message-format plainwas39.6 ms ± 0.7 ms.rust-analyzer: the same commands were122.5 ms ± 5.7 msand45.5 ms ± 2.4 ms.testing
cargo xfmt --checkcargo check -p cargo-nextest -p integration-testscargo nextest run -p cargo-nextestcargo nextest run -p integration-tests -E 'test(test_list_binaries_only) or test(test_list_binaries_only_after_build) or test(test_list_full_after_build) or test(test_list_host_after_build) or test(test_list_target_after_build)'