Why is rustdoc from nightly 1.6x faster than my build from master


#1

Have tried and failed to find the reason why “rustdoc --test” with the rustdoc version that I get with rustup is 1.6x (13s vs 22s) faster than the rustdoc that is built during test of rustc (./x.py test).

Have used an clean clone from master to build. Is there some config to be done in the config.toml file or is there some difference in how the two versions is built that is the “problem”?

test file lib.rs
/// ```
/// let five = 5;
///
/// assert_eq!(6, add_one(5));
/// fn add_one(x: i32) -> i32 {
///     x + 1
/// }
/// ```
... 258 times
/// ```
/// let five = 5;
///
/// assert_eq!(6, add_one(5));
/// fn add_one(x: i32) -> i32 {
///     x + 1
/// }
/// ```
pub fn add_one(x: i32) -> i32 {
    x + 1
}
cmd
andreas@Threadripper:~/tmp$ time rustdoc --test src/lib.rs

running 260 tests
test src/lib.rs - add_one (line 1035) ... ok
...

test result: ok. 260 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

real	0m13,822s
user	1m14,041s
sys	1m35,835s
andreas@Threadripper:~/tmp$ time /home/andreas/rust/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc --test src/lib.rs

running 260 tests
test src/lib.rs - add_one (line 1017) ... ok
...

test result: ok. 260 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

real	0m22,036s
user	1m10,724s
sys	1m49,057s
andreas@Threadripper:~/tmp$ time RUST_TEST_THREADS=6 rustdoc --test src/lib.rs

running 260 tests
test src/lib.rs - add_one (line 1017) ... ok
...

test result: ok. 260 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

real	0m10,384s
user	0m41,044s
sys	0m15,491s
andreas@Threadripper:~/tmp$ time RUST_TEST_THREADS=6 /home/andreas/rust/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc --test src/lib.rs

running 260 tests
test src/lib.rs - add_one (line 1026) ... ok
...

test result: ok. 260 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

real	0m11,848s
user	0m41,827s
sys	0m17,611s
andreas@Threadripper:~/tmp$ which rustdoc 
/home/andreas/.cargo/bin/rustdoc
andreas@Threadripper:~/tmp$ rustup show
Default host: x86_64-unknown-linux-gnu

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)

active toolchain
----------------

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.25.0-nightly (6828cf901 2018-01-06)

andreas@Threadripper:~/rust$ git show
commit 6828cf90146c7fefc4ba4f16dffe75f763f2d910 (HEAD -> master)