rustup: Installing rust-docs component on Windows 10 is very slow
As reported on the User’s Forum, installing the rust-docs component on Windows 10 is currently very slow compared to other components, even on machines with an SSD and multi-core processor.
I did some testing of Rustup on Windows with ProcessMonitor capturing all file events. The creation of a single file in rust-docs requires 18 “syscalls”:
8:56:27.9670280 AM rustup.exe 20964 CreateFile C:\Users\gordon.tyler\.rustup\tmp\tnchg8cf2r9owb5i_dir\rust-docs\share\doc\rust\html\std\macro.vec.html NAME NOT FOUND Desired Access: Read Attributes, Delete, Disposition: Open, Options: Non-Directory File, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
8:56:27.9675751 AM rustup.exe 20964 CreateFile C:\Users\gordon.tyler\.rustup\tmp\tnchg8cf2r9owb5i_dir\rust-docs\share\doc\rust\html\std\macro.vec.html SUCCESS Desired Access: Generic Write, Read Attributes, Disposition: OverwriteIf, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: 0, OpenResult: Created
8:56:27.9684873 AM rustup.exe 20964 QuerySecurityFile C:\Users\gordon.tyler\.rustup\tmp\tnchg8cf2r9owb5i_dir\rust-docs\share\doc\rust\html\std\macro.vec.html SUCCESS Information: Attribute
8:56:27.9685802 AM rustup.exe 20964 WriteFile C:\Users\gordon.tyler\.rustup\tmp\tnchg8cf2r9owb5i_dir\rust-docs\share\doc\rust\html\std\macro.vec.html SUCCESS Offset: 0, Length: 7,420, Priority: Normal
8:56:27.9687324 AM rustup.exe 20964 CloseFile C:\Users\gordon.tyler\.rustup\tmp\tnchg8cf2r9owb5i_dir\rust-docs\share\doc\rust\html\std\macro.vec.html SUCCESS
8:56:27.9790328 AM rustup.exe 20964 CreateFile C:\Users\gordon.tyler\.rustup\tmp\tnchg8cf2r9owb5i_dir\rust-docs\share\doc\rust\html\std\macro.vec.html SUCCESS Desired Access: Generic Write, Read Attributes, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
8:56:27.9793741 AM rustup.exe 20964 QuerySecurityFile C:\Users\gordon.tyler\.rustup\tmp\tnchg8cf2r9owb5i_dir\rust-docs\share\doc\rust\html\std\macro.vec.html SUCCESS Information: Attribute
8:56:27.9794153 AM rustup.exe 20964 SetBasicInformationFile C:\Users\gordon.tyler\.rustup\tmp\tnchg8cf2r9owb5i_dir\rust-docs\share\doc\rust\html\std\macro.vec.html SUCCESS CreationTime: 0, LastAccessTime: 2018-11-04 3:13:44 PM, LastWriteTime: 2018-11-04 3:13:44 PM, ChangeTime: 0, FileAttributes: n/a
8:56:27.9795474 AM rustup.exe 20964 CloseFile C:\Users\gordon.tyler\.rustup\tmp\tnchg8cf2r9owb5i_dir\rust-docs\share\doc\rust\html\std\macro.vec.html SUCCESS
8:56:27.9799556 AM rustup.exe 20964 CreateFile C:\Users\gordon.tyler\.rustup\tmp\tnchg8cf2r9owb5i_dir\rust-docs\share\doc\rust\html\std\macro.vec.html SUCCESS Desired Access: Read Attributes, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
8:56:27.9800764 AM rustup.exe 20964 QuerySecurityFile C:\Users\gordon.tyler\.rustup\tmp\tnchg8cf2r9owb5i_dir\rust-docs\share\doc\rust\html\std\macro.vec.html SUCCESS Information: Attribute
8:56:27.9801085 AM rustup.exe 20964 QueryInformationVolume C:\Users\gordon.tyler\.rustup\tmp\tnchg8cf2r9owb5i_dir\rust-docs\share\doc\rust\html\std\macro.vec.html BUFFER OVERFLOW VolumeCreationTime: 2017-01-18 7:26:52 PM, VolumeSerialNumber: 28BB-82BA, SupportsObjects: True, VolumeLabel: WinՂ
8:56:27.9801349 AM rustup.exe 20964 QueryAllInformationFile C:\Users\gordon.tyler\.rustup\tmp\tnchg8cf2r9owb5i_dir\rust-docs\share\doc\rust\html\std\macro.vec.html BUFFER OVERFLOW CreationTime: 2018-11-05 8:56:27 AM, LastAccessTime: 2018-11-04 3:13:44 PM, LastWriteTime: 2018-11-04 3:13:44 PM, ChangeTime: 2018-11-05 8:56:27 AM, FileAttributes: A, AllocationSize: 8,192, EndOfFile: 7,420, NumberOfLinks: 1, DeletePending: False, Directory: False, IndexNumber: 0x8000000202cb1, EaSize: 0, Access: Read Attributes, Synchronize, Position: 0, Mode: Synchronous IO Non-Alert, AlignmentRequirement: Long
8:56:27.9801636 AM rustup.exe 20964 CloseFile C:\Users\gordon.tyler\.rustup\tmp\tnchg8cf2r9owb5i_dir\rust-docs\share\doc\rust\html\std\macro.vec.html SUCCESS
8:56:27.9804884 AM rustup.exe 20964 CreateFile C:\Users\gordon.tyler\.rustup\tmp\tnchg8cf2r9owb5i_dir\rust-docs\share\doc\rust\html\std\macro.vec.html SUCCESS Desired Access: Write Attributes, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
8:56:27.9806919 AM rustup.exe 20964 QuerySecurityFile C:\Users\gordon.tyler\.rustup\tmp\tnchg8cf2r9owb5i_dir\rust-docs\share\doc\rust\html\std\macro.vec.html SUCCESS Information: Attribute
8:56:27.9807270 AM rustup.exe 20964 SetBasicInformationFile C:\Users\gordon.tyler\.rustup\tmp\tnchg8cf2r9owb5i_dir\rust-docs\share\doc\rust\html\std\macro.vec.html SUCCESS CreationTime: 0, LastAccessTime: 0, LastWriteTime: 0, ChangeTime: 0, FileAttributes: AN
8:56:27.9807689 AM rustup.exe 20964 CloseFile C:\Users\gordon.tyler\.rustup\tmp\tnchg8cf2r9owb5i_dir\rust-docs\share\doc\rust\html\std\macro.vec.html SUCCESS
Needing 5x CreateFile for each file definitely sounds bug-worthy…
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 27
- Comments: 58 (37 by maintainers)
Commits related to this issue
- Allow more time for `rustup-init install` Due to rust-lang/rustup.rs#1540, installing the docs on Windows can be slow enough to time out a fresh rustc install. Marking this `Command` as `quiet` incre... — committed to ecstatic-morse/crater by ecstatic-morse 5 years ago
- Allow more time for `rustup-init install` Due to rust-lang/rustup.rs#1540, installing the docs on Windows can be slow enough to time out a fresh rustc install. Marking this `Command` as `quiet` incre... — committed to ecstatic-morse/crater by ecstatic-morse 5 years ago
- Allow more time for `rustup-init install` Due to rust-lang/rustup.rs#1540, installing the docs on Windows can be slow enough to time out a fresh rustc install. Marking this `Command` as `quiet` incre... — committed to ecstatic-morse/crater by ecstatic-morse 5 years ago
- Allow more time for `rustup-init install` Due to rust-lang/rustup.rs#1540, installing the docs on Windows can be slow enough to time out a fresh rustc install. Marking this `Command` as `quiet` incre... — committed to ecstatic-morse/crater by ecstatic-morse 5 years ago
- Allow more time for `rustup-init install` Due to rust-lang/rustup.rs#1540, installing the docs on Windows can be slow enough to time out a fresh rustc install. Marking this `Command` as `quiet` incre... — committed to ecstatic-morse/crater by ecstatic-morse 5 years ago
- Allow more time for `rustup-init install` Due to rust-lang/rustup.rs#1540, installing the docs on Windows can be slow enough to time out a fresh rustc install. Marking this `Command` as `quiet` incre... — committed to ecstatic-morse/crater by ecstatic-morse 5 years ago
- Allow more time for `rustup-init install` Due to rust-lang/rustup.rs#1540, installing the docs on Windows can be slow enough to time out a fresh rustc install. Marking this `Command` as `quiet` incre... — committed to ecstatic-morse/crater by ecstatic-morse 5 years ago
- Allow more time for `rustup-init install` Due to rust-lang/rustup.rs#1540, installing the docs on Windows can be slow enough to time out a fresh rustc install. Marking this `Command` as `quiet` incre... — committed to ecstatic-morse/crater by ecstatic-morse 5 years ago
At this point I think the only fair thing to do is make
rust-docsinstallation slow on all other platforms too. That way the predominantly linux/mac using community of Rust will finally care about this problem and get it fixed.The sources are still 2,307 files. While not as bad as the 15,377 files of the docs, it’s still a hefty chunk of time. Really we should just not extract
rust-docsuntil the user asks for the docs. That way people who are offline can still have the docs without remembering to install them ahead of time, without making installation and upgrading such a slow process for other users.@retep998 This seems very reasonable, and I agree with @kryptan that most users will never use
rust-docs(unless somehow some IDE makes use of it automatically). For example, I knowintellij-rustcan navigate into thestdsource from user code which is pretty nice.What would be the workflow envisioned for this? Something like the following?
@kinnison: while I do agree that
minimalprofile allows to avoid installing documentation and resolves #998, the fact that documentation installation is slow on Windows is still valid.Rather than fixing this, Windows should definitely realize that slowing their system down like this isnt acceptable.
It’s an issue in Windows, not rustup.
@rbtcollins Even if we had perfect disk access, installing
rust-docswould still take a long time. This issue is for taking measures such as not extracting the docs until needed or even not downloading them at all.I’m now involved in a discussion with Defender folk ; they’ve asked for traces of the poor behaviour. Please use rustup 1.18.3 or newer, nothing older, as there is no point sending in unoptimised traces IMO.
We only need 3-4 traces from a few different machines where Defender overhead is the problem; I’ll be submitting one from a surface pro and one from a 2990WX. If someone has a machine with e.g. spinning metal disks, or even less cores or whatever - something interestingly different, please add the trace id here.
For us the use case we’re tracing is unpack performance, so I’d suggest running rustup uninstall nightly, rustup install nightly waiting for it to start installation, then copy the contents of ~/.rustup/downloads/* to a temp dir. The rustup uninstall nightly. Then copy that temp dir contents back to the the downloads dir.
Finally, start the trace and then run rustup install nightly.
Instructions for gathering a trace (note this captures most metadata about what the system is doing…):
It is also slow if you install Rust in WSL. Filesystem is just very slow on Windows. I would prefer to not install docs if it was possible.
@uis246 Are you looking for https://lobste.rs/s/yne5kz/ntfs_really_isn_t_bad_robert_collins_lca?
You have little hope at staying in the FOSS world for your toolchains and build systems if you are using Windows, else you’d be suffering quite big constraints like this performance one. Stuff to make cab or msi files arent FOSS. Code signing certificates are the same thing, they’re an administrative cost.
Windows Defender who is the principal contributor to this issue, is spinning up whole arbitrary file type parsers between system calls, there’s nothing to do about it but to change Windows Defender and thus Windows, who has it enabled by default. I understand the problem of using a monolithic system where any program gets access to the whole filesystem without an Anti-Virus, but it’s not like we can’t do better than monolithic these days.
As a workaround, I would be looking at trying to extract the file in a way that Windows Defender can clearly recognize the relationship between it’s archived copy and it’s extracted copy, Windows Defender will scan archives when they are written already, if it can identify that the file is being copied out of an archive it already scanned, it does not need to scan it again.
You might want to use a third party tool for this, a third party tool that is trusted by Windows Defender, that most commonly happens when it has a digital signature with some history of having good behavior. Windows might have some command line tools to extract archives.
I agree with @retep998 , #904 can improve things, but with this amount of files, I don’t think it’s a “strict duplicate”. It’s related, but not duplicate.
I think this is a strict duplicate of #904 - the rust-docs component shows the pathology most severely, but its not unique to rust-docs.
A related issue reported on the User’s Forum and #1464:
Another data point from @chriskrycho: