Repository navigation
perf: Do not build SBOM if user has not set build.sbom - #17412
Merged
Merged
Conversation
Before this commit, the SBOM would be generated in memory and be thrown away instead of written to a file. For projects with a large dependency graph, this can add noticable delay (~100ms for around 1,000 dependencies)
weihanglo
approved these changes
Aug 30, 2026
Member
|
I'm not very familiar with the implementation, but this sounds good to me. |
rust-bors Bot
pushed a commit
to rust-lang/rust
that referenced
this pull request
Sep 2, 2026
Update cargo submodule 26 commits in e8cb624d5701824f46a2ec5873cfd59ee3d2f66c..b2e9d5f9db3fb1c454ab84f10c16508984a266e2 2026-08-22 00:23:45 +0000 to 2026-09-02 14:49:16 +0000 - fix(parser): Resolve theoretical use-after-free (rust-lang/cargo#17428) - fix(trim-paths)!: remove default scope from release profile (rust-lang/cargo#17424) - fix(git): Use git's 429 retry, when available (rust-lang/cargo#17422) - Avoid passing search path (-L) args when they are passed as --extern (rust-lang/cargo#17410) - chore(deps): update crate-ci/typos action to v1.50.0 (rust-lang/cargo#17417) - test: Move -Z onto its own line (rust-lang/cargo#17416) - chore(triagebot): enable `@rustbot merge/delegate` (rust-lang/cargo#17415) - Micro-optimize two package dir functions (rust-lang/cargo#17413) - perf: Do not build SBOM if user has not set build.sbom (rust-lang/cargo#17412) - feat(manifest)!: implement feature-metadata RFC3416 (rust-lang/cargo#15056) - Cargo profiling improvements (rust-lang/cargo#17411) - test(git): Remove gix override run in CI and the mode in code (rust-lang/cargo#17405) - perf(git): Reduce extra work when using git-cli (rust-lang/cargo#17406) - feat(resolver): Stabilize min-publish-age (rust-lang/cargo#17335) - fix(git): Remove ref status update when showing progress (rust-lang/cargo#17400) - revert: refactor: move sysroot lookup to GlobalContext (rust-lang/cargo#17401) - fix(run): Printing a new line to avoid overwriting error code after \r (rust-lang/cargo#17373) - fix(trim-paths): custom workspace-relative member paths remap (rust-lang/cargo#17366) - fix(home): rustdoc lint (rust-lang/cargo#17394) - feat(diag): Stabilize cargo-lints (rust-lang/cargo#17298) - chore(deps): Update partial_ref to v0.3.4 (rust-lang/cargo#17392) - refactor: remove ad-hoc `subslice_range` (rust-lang/cargo#17390) - docs(changelog): move build-dir new layout to Changed (rust-lang/cargo#17387) - chore(deps): update msrv (1 version) to v1.98 (rust-lang/cargo#17386) - docs: Use mdbook admonitions (rust-lang/cargo#17384) - chore(ci): exclude resolver-tests from intra doc link checks (rust-lang/cargo#17385)
Quik2007
pushed a commit
to tilo-os/tilo
that referenced
this pull request
Nov 4, 2026
cargo 1.97.1 builds every unit's SBOM, its whole dependency closure, when it prepares the unit's compile, and throws it away unless build.sbom asks for one. t's compiler wrapper queues compiles, so cargo holds them all: about 1.2 GB of the test family driver's 1.6 GB peak, and about 450 GB across the 280 drivers on one CI node. The builder now replaces the pinned toolchain's bin/cargo with cargo 1.97.1 (c980f4866, the commit Rust 1.97.1 ships) built from source with rust-lang/cargo#17412 cherry-picked (97888918b, first in cargo 1.100). rustc and every other component stay the toolchain's, so compile keys are unchanged. The build adds about a minute and a half; it fails once rust-toolchain.toml moves on, when the script and patch are to be deleted. In the builder image (aarch64), the test family's driver with every compile held: 1.95 GB before, 0.61 GB after. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Quik2007
pushed a commit
to tilo-os/tilo
that referenced
this pull request
Nov 5, 2026
The default check image and ci-fast's tools image move to the builder t published for 108e17e (index 5a72b2a9..., amd64), whose cargo reports `(tilo: rust-lang/cargo#17412)`. Its rustc, librustc_driver, clippy-driver and libstd are byte-identical to the previous builder's, so compiles keep their cache entries; only links, keyed by the image's digest, rebuild once. The goldens, Windows and OS-image build pins stay where they are. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 does this PR try to resolve?
Before this PR, the SBOM would be generated in memory and be thrown away instead of written to a file. For projects with a large dependency graph, this can add noticeable delay.
Below is a profiling run on Zed.
On a cold build, this is a very small part of the work, but we have to pay this price on every build.
But when trying to do repeated builds while iterating this time starts to add up.
How to test and review this PR?
I primarily was doing profiling on Zed when I found this. (also see: #17411)
I did not add any additional tests since there aren't really any outputs to compare against.
Hoping the existing SBOM tests are good enough, but happy to add a test for this if there is a way I am missing :)
r? @arlosi
cc: @Shnatsel
cc: #16565