Description
Problem
@ehuss noticed that workspace inheritance caused a significant increase in startup times when using workspace inheritance.
When running the same test (as described here) I got
Benchmark 1: cd rust; cargo +nightly metadata
Time (mean ± σ): 156.7 ms ± 2.3 ms [User: 110.0 ms, System: 35.3 ms]
Range (min … max): 152.5 ms … 161.0 ms 18 runs
Benchmark 2: cd rust2; cargo +nightly metadata
Time (mean ± σ): 199.9 ms ± 1.2 ms [User: 150.0 ms, System: 38.8 ms]
Range (min … max): 196.8 ms … 202.5 ms 14 runs
Summary
'cd rust; cargo +nightly metadata' ran
1.28 ± 0.02 times faster than 'cd rust2; cargo +nightly metadata'
This is a large increase in time and should be addressed before stabilization
Steps
Original steps
Modified steps using +nightly
-
Extract this file in
benches/workspaces
rust2.zipThis is just a quick hack that adds inheritance to a bunch of packages, but I didn't really put much thought into setting it up.
-
Extract
rust.tgz
in that directory, too. -
Prime the target directory with a cache of
rustc
info. Inrust
andrust2
, run:cargo +nightly c -p linkchecker
. Otherwise it would be measuringrustc
overhead. -
Test out some command that spends most of its time loading the workspace. There aren't very many good candidates, but
cargo metadata
orcargo tree
can work. I use hyperfine for quick measurements. For example:
hyperfine "cd rust; cargo +nightly metadata" "cd rust2; cargo +nightly metadata"
Possible Solution(s)
One possible solution would be to record paths of workspace roots that can be checked before walking the filesystem to look for a workspace root. The biggest problem with this is where to record everything. Config
is one place and there is some precedence for a cache being put in there.
Notes
No response
Version
cargo 1.63.0-nightly (4d92f07f3 2022-06-09)
release: 1.63.0-nightly
commit-hash: 4d92f07f34ba7fb7d7f207564942508f46c225d3
commit-date: 2022-06-09
host: aarch64-apple-darwin
libgit2: 1.4.2 (sys:0.14.2 vendored)
libcurl: 7.79.1 (sys:0.4.55+curl-7.83.1 system ssl:(SecureTransport) LibreSSL/3.3.6)
os: Mac OS 12.4.0 [64-bit]