With an empty lib crate with a single dependency on winapi = "0.2"
, rustdoc takes 13 minutes. I am certain it didn't take this long before, but I've not been able to find an older release that is faster (so could be something strange on my machine). other crates are not this slow. CC @retep998
rustc 1.18.0-nightly (1785bca51 2017-04-21)
binary: rustc
commit-hash: 1785bca5137fad1f26e4d3c347cbb68408a28fa9
commit-date: 2017-04-21
host: x86_64-pc-windows-msvc
release: 1.18.0-nightly
LLVM version: 3.9
Compiling winapi v0.2.8
Documenting winapi v0.2.8
Running `rustc --crate-name winapi C:\Users\achin\.cargo\registry\src\github.com-1ecc6299db9ec823\winapi-0.2.8\src\lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=9e8506a37ca459a2 -C extra-filename=-9e8506a37ca459a2 --out-dir z:\temp\testhing\target\debug\deps -L dependency=z:\temp\testhing\target\debug\deps --cap-lints allow`
Running `rustdoc --crate-name winapi C:\Users\achin\.cargo\registry\src\github.com-1ecc6299db9ec823\winapi-0.2.8\src\lib.rs -o z:\temp\testhing\target\doc -L dependency=z:\temp\testhing\target\debug\deps`
Documenting testhing v0.1.0 (file:///Z:/temp/testhing)
Running `rustdoc --crate-name testhing src\lib.rs -o z:\temp\testhing\target\doc -L dependency=z:\temp\testhing\target\debug\deps --extern winapi=z:\temp\testhing\target\debug\deps\libwinapi-9e8506a37ca459a2.rlib`
Finished dev [unoptimized + debuginfo] target(s) in 748.37 secs
Beta:
z:\temp\testhing>rustup run beta rustc --verbose --version
rustc 1.17.0-beta.3 (ca3d11832 2017-04-05)
binary: rustc
commit-hash: ca3d11832caf6acac4516b976f715b4ed07f48dd
commit-date: 2017-04-05
host: x86_64-pc-windows-msvc
release: 1.17.0-beta.3
LLVM version: 3.9
z:\temp\testhing>rustup run beta cargo doc
Compiling winapi v0.2.8
Documenting winapi v0.2.8
Documenting testhing v0.1.0 (file:///Z:/temp/testhing)
Finished dev [unoptimized + debuginfo] target(s) in 809.23 secs
Stable:
z:\temp\testhing>rustup run stable rustc --verbose --version
rustc 1.16.0 (30cf806ef 2017-03-10)
binary: rustc
commit-hash: 30cf806ef8881c41821fbd43e5cf3699c5290c16
commit-date: 2017-03-10
host: x86_64-pc-windows-msvc
release: 1.16.0
LLVM version: 3.9
z:\temp\testhing>rustup run stable cargo doc
Documenting winapi v0.2.8
Compiling winapi v0.2.8
Documenting testhing v0.1.0 (file:///Z:/temp/testhing)
Finished dev [unoptimized + debuginfo] target(s) in 755.20 secs
I'm genuinely surprised I could not find an existing issue for this considering how many times it has been brought up on IRC.
The reason rustdoc is slow is because winapi has so many definitions, and rustdoc emits a file for each definition. Normally this isn't a problem, but on Windows having an anti virus is a very common thing, especially with Windows Defender being used by default. Unfortunately, AVs have a rather high fixed cost per file created, so even if you have a fast SSD, it is still incredibly slow due to the AV holding up rustdoc while it scans each file. If you set an exception in Windows Defender for your programming folder, you can make compilation and documentation a lot faster.
Here are some numbers for documenting winapi without the interference of an AV.
winapi 0.2 71,195 files in 100.64 seconds
winapi 0.3 73,389 files in 51.98 seconds
Woah! Adding a Windows Defender exclusion on this development directory brought the time down to only 30 seconds. 25 times faster!
Most helpful comment
I'm genuinely surprised I could not find an existing issue for this considering how many times it has been brought up on IRC.
The reason rustdoc is slow is because winapi has so many definitions, and rustdoc emits a file for each definition. Normally this isn't a problem, but on Windows having an anti virus is a very common thing, especially with Windows Defender being used by default. Unfortunately, AVs have a rather high fixed cost per file created, so even if you have a fast SSD, it is still incredibly slow due to the AV holding up rustdoc while it scans each file. If you set an exception in Windows Defender for your programming folder, you can make compilation and documentation a lot faster.
Here are some numbers for documenting winapi without the interference of an AV.
winapi 0.2 71,195 files in 100.64 seconds
winapi 0.3 73,389 files in 51.98 seconds