Skip to content

Commit 7f8760a

Browse files
committed
Auto merge of rust-lang#8451 - matthiaskrgr:ui_speedup, r=llogiq
tests: default to more threads for ui-tests Benchmarks (tested on i5-7200U, 2 cores, 4 threads) ``` master branch: cargo test // prime caches cargo --color=always test 70,39s user 21,91s system 180% cpu 51,035 total cargo --color=always test 70,77s user 22,13s system 180% cpu 51,579 total cargo --color=always test 70,97s user 22,12s system 180% cpu 51,673 total cargo --color=always nextest run 78,74s user 22,27s system 220% cpu 45,829 total cargo --color=always nextest run 78,46s user 21,92s system 224% cpu 44,674 total cargo --color=always nextest run 78,31s user 22,21s system 228% cpu 43,909 total Patched (ui_speedup branch): cargo test // prime cache cargo --color=always test 97,51s user 32,02s system 288% cpu 44,905 total cargo --color=always test 99,19s user 31,91s system 276% cpu 47,436 total cargo --color=always test 98,47s user 31,84s system 284% cpu 45,744 total cargo --color=always nextest run 102,18s user 30,80s system 350% cpu 37,902 total cargo --color=always nextest run 99,75s user 29,86s system 350% cpu 36,935 total cargo --color=always nextest run 100,36s user 29,93s system 351% cpu 37,061 total ``` changelog: use more threads for running clippys ui-tests for ~10% walltime speedup
2 parents 9e605ef + a89c795 commit 7f8760a

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ syn = { version = "1.0", features = ["full"] }
5050
futures = "0.3"
5151
parking_lot = "0.11.2"
5252
tokio = { version = "1", features = ["io-util"] }
53+
num_cpus = "1.13"
5354

5455
[build-dependencies]
5556
rustc_tools_util = { version = "0.2", path = "rustc_tools_util" }

tests/compile-test.rs

+5
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ fn run_ui() {
162162
let config = base_config("ui");
163163
// use tests/clippy.toml
164164
let _g = VarGuard::set("CARGO_MANIFEST_DIR", fs::canonicalize("tests").unwrap());
165+
let _threads = VarGuard::set(
166+
"RUST_TEST_THREADS",
167+
// if RUST_TEST_THREADS is set, adhere to it, otherwise override it
168+
env::var("RUST_TEST_THREADS").unwrap_or_else(|_| num_cpus::get().to_string()),
169+
);
165170
compiletest::run_tests(&config);
166171
}
167172

0 commit comments

Comments
 (0)