-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
testsuite: Improve performance when using rustup. #9206
Conversation
r? @Eh2406 (rust-highfive has picked a reviewer for you, use r? to override) |
Worth a try, we can always back it out if it breaks something. @bors r+ |
📌 Commit c73765f has been approved by |
☀️ Test successful - checks-actions |
testsuite: Use split debuginfo on macos. This switches the testsuite to use "unpacked" debuginfo on macos, which is a substantial performance boost. On my system, the testsuite runs 1.55 times faster with this change. Along with #9206, total testsuite time is 3.1 times faster.
Nice, here's the change in CI:
(Not very accurate since each run can use different hardware, but still pretty reasonable.) |
Do you have a good sense for why rustup is adding so much overhead here? Is it just the overhead of having a separate process or is rustup doing something particularly slow? |
I'm not too familiar with rustup's internals. The overhead of rustup for running There is more discussion of this at rust-lang/rustup#2626. From a quick look, it seems like rustup is loading the config file (using TOML which is pretty slow), and doing all sorts of manifest processing and more. Kinnison also noted there is some dylib startup cost. I don't know why it does that once |
Phew, well at least these are some very nice improvements, thanks for investigating and measuring this @ehuss! |
Update cargo 12 commits in 572e201536dc2e4920346e28037b63c0f4d88b3c..c68432f1e5cbbc09833699a951b1b5b059651dff 2021-02-24 16:51:20 +0000 to 2021-03-02 18:26:29 +0000 - Don't panic when printing JSON with non-utf8 paths (rust-lang/cargo#9226) - Detect changes for JSON spec targets. (rust-lang/cargo#9223) - Fix `cargo_target_empty_cfg` test with env var. (rust-lang/cargo#9225) - Correct default cargo new edition (rust-lang/cargo#9202) - Update split-debuginfo docs around the default. (rust-lang/cargo#9224) - Minor update to registry API error messages. (rust-lang/cargo#9213) - Some minor code cleanup. (rust-lang/cargo#9214) - doc: Fix spelling worksapce->workspace (rust-lang/cargo#9212) - Update SPDX version in docs. (rust-lang/cargo#9209) - Throw error if CARGO_TARGET_DIR is an empty string (rust-lang/cargo#8939) - testsuite: Use split debuginfo on macos. (rust-lang/cargo#9207) - testsuite: Improve performance when using rustup. (rust-lang/cargo#9206)
Make it easier to run testsuite with a custom toolchain. The optimization added in #9206 to circumvent the rustup wrapper for rustc had a bad interaction when using a custom toolchain (like `cargo +stage1 test`). It was using the `rustc` from where `cargo` is located, but custom toolchains often don't have cargo. This would instead use the nightly rustc (due to rustup's [fallback](https://github.com/rust-lang/rustup/blob/eaee3e723cd44b4b968b79b0ec2e8f766f1dfc77/src/config.rs#L942-L975)). This changes it to query rustup directly to ask it where the overridden rustc is located.
The rustup wrapper adds a considerable amount of overhead when running processes like
rustc
. This overridesPATH
when running the testsuite to prioritize the actual executables to avoid the wrapper.I'm not 100% confident this won't break something somewhere, but it seems like it should be safe.
In my tests, this makes the testsuite 1.5 to 1.7 times faster.