Skip to content

Installing rust-docs component on Windows 10 is very slow #1540

Closed

Description

@johnthagen

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…

Activity

  1. johnthagen commented on Nov 9, 2018

    @johnthagen
    ContributorAuthor
  2. changed the title [-]Install rust-docs on Windows 10 is very slow[/-] [+]Installing rust-docs on Windows 10 is very slow[/+] on Nov 9, 2018
  3. changed the title [-]Installing rust-docs on Windows 10 is very slow[/-] [+]Installing rust-docs component on Windows 10 is very slow[/+] on Nov 9, 2018
  4. johnthagen commented on Nov 10, 2018

    @johnthagen
    ContributorAuthor

    I did timed sample run:

    >rustup install beta
    info: syncing channel updates for 'beta-x86_64-pc-windows-msvc'
    info: latest update on 2018-11-09, rust version 1.31.0-beta.5 (bf00632e3 2018-11-08)
    info: downloading component 'rustc'
     54.1 MiB /  54.1 MiB (100 %)   6.8 MiB/s ETA:   0 s
    info: downloading component 'rust-std'
     47.8 MiB /  47.8 MiB (100 %)   6.8 MiB/s ETA:   0 s
    info: downloading component 'cargo'
    info: downloading component 'rust-docs'
      9.1 MiB /   9.1 MiB (100 %)   7.4 MiB/s ETA:   0 s
    info: installing component 'rustc'
    info: installing component 'rust-std'
    info: installing component 'cargo'
    info: installing component 'rust-docs'
    
      beta-x86_64-pc-windows-msvc installed - rustc 1.31.0-beta.5 (bf00632e3 2018-11-08)
    

    All of the other components installed in a mater of a couple seconds, but rust-docs took a staggering 2 minutes and 42 seconds to install! 😱

    This is on a Windows 10 machine with a quad core i5 @ 4GHz and an SSD. All 4 cores are pegged up at around 60-80% for the duration of the install.

  5. johnthagen commented on Nov 10, 2018

    @johnthagen
    ContributorAuthor

    It appears that Windows Defender is definitely involved, based on a CPU usage capture during the install of rust-docs:

    rustup_usage

  6. ndrewxie commented on Nov 10, 2018

    @ndrewxie

    Yes, Windows Defender does cause significant slowdowns - however, turning off real time protection doesn't help very much - it still takes forever. Maybe I should be doing something more than just disabling real time protection? At this point I'm seriously annoyed - multiple people have opened issues for this, and suggested changes such as making the doc optional, merging the small files in the doc into a few large files to accommodate for slow file systems, etc - nothing has really been done so far except "disable your antivirus".

  7. johnthagen commented on Nov 10, 2018

    @johnthagen
    ContributorAuthor

    multiple people have opened issues for this

    @ndrewxie Could you please link those issues to this one? I opened this because I thought it hadn't been officially reported yet. Best to link any previous discussions together.

  8. retep998 commented on Nov 10, 2018

    @retep998
    Contributor

    At this point I think the only fair thing to do is make rust-docs installation 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.

  9. johnthagen commented on Nov 10, 2018

    @johnthagen
    ContributorAuthor

    At this point I'm seriously annoyed

    At this point I think the only fair thing to do is make rust-doc installation slow on all other platforms too.

    As a polyglot Windows and Mac user, I do feel sometimes that Windows support lags behind Linux and Mac in subtle ways (like this issue, for example), but I'd like to try to keep this issue focused on this particular issue, and the concrete ways the situation can be improved.

  10. Michael-F-Bryan commented on Nov 13, 2018

    @Michael-F-Bryan

    I'm normally a Linux user, but found myself trying to do some project work on Windows today and my god is everything slow.

    Are there concrete reasons why creating lots of small files (which rustc loves doing) is such an expensive thing on Windows? I can see Windows Defender consuming quite a lot of CPU and disk IO so I'm assuming that has something to do with it.

    I'm not super familiar with how Windows does things like its filesystem and Windows Defender under the hood, but I'd be keen to help out. Besides telling all Windows users to turn off their antivirus are there any other ways to mitigate this poor performance? It sounds like we're not the only community suffering from poor filesystem performance because people have had the same issues with node_modules in the JavaScript world.

  11. kryptan commented on Nov 15, 2018

    @kryptan

    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.

  12. johnthagen commented on Nov 23, 2018

    @johnthagen
    ContributorAuthor

    Another data point from @chriskrycho:

    As it stands, Windows builds on CI take ~5⨉ longer than Linux or macOS just to get through the setup step 3, because NTFS kind of chokes when dealing with a large number of small files

  13. johnthagen commented on Nov 29, 2018

    @johnthagen
    ContributorAuthor

    More discussion on this internals thread.

    Issue previously reported: #763

    Issue to make rust-docs optional: #998

    @nrc Appears to be working on profiles to help address this: #998 (comment)

  14. doxxx commented on Nov 30, 2018

    @doxxx

    The rust-src component is pretty slow to install on Windows as well. Not as bad as the docs, but it takes noticeably longer than any of the other components.

  15. doxxx commented on Nov 30, 2018

    @doxxx

    I've been looking at the rustup code to see how it works with files. If I understand correctly, updating a component is performed in a transaction where each original file is moved to a temp folder before the new file is written in its place.

    I was wondering if it would be viable to simply rename the toolchain folder? That would significantly reduce the number of file operations to perform. However, this would only work for toolchain updates, not component installation/removal.

    That said, installing a new toolchain (i.e. not updating) is slow as well, so this may be a red herring.

  16. 40 remaining items

  17. kinnison commented on Oct 18, 2019

    @kinnison
    Contributor

    With 1.20 you can set the profile to minimal and obviate the need to install rust-docs so I consider this done. If you still want the docs and their installation remains too slow, please open a fresh issue to discuss possible mitigations.

  18. slonopotamus commented on Oct 18, 2019

    @slonopotamus

    @kinnison: while I do agree that minimal profile allows to avoid installing documentation and resolves #998, the fact that documentation installation is slow on Windows is still valid.

  19. kinnison commented on Oct 18, 2019

    @kinnison
    Contributor

    I agree that the form of rust-docs remains an issue, but it's not specific to Windows (though we are a lot better now providing you're not using something like McAfee) and any mitigations we come up with will need to be cross-platform or potentially something which changes how the rustdoc itself is generated.

  20. uis246 commented on Mar 24, 2024

    @uis246

    I remember watching some video based on this issue about io performance and ms defender. Can anyone send link here please?

  21. rami3l commented on Mar 24, 2024

    @rami3l
    Member

    I remember watching some video based on this issue about io performance and ms defender. Can anyone send link here please?

    @uis246 Are you looking for https://lobste.rs/s/yne5kz/ntfs_really_isn_t_bad_robert_collins_lca?

  22. uis246 commented on Mar 24, 2024

    @uis246

    @rami3l Yes, thank you.

  23. LukeLIN-web commented on Nov 17, 2024

    @LukeLIN-web

    I also meet this problem in linux,

    info: installing component 'rustc'
     70.8 MiB /  70.8 MiB (100 %)  12.5 MiB/s in  6s ETA:  0s
    info: installing component 'cargo'
    info: installing component 'rust-std'
     26.0 MiB /  26.0 MiB (100 %)  11.0 MiB/s in  2s ETA:  0s
    info: installing component 'rust-docs'
      4.8 MiB /  16.3 MiB ( 29 %)  20.8 KiB/s in 42s ETA:  9m 29s
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions