Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow startup on Windows #1353

Closed
Vlad-Shcherbina opened this issue Feb 8, 2018 · 16 comments
Closed

Slow startup on Windows #1353

Vlad-Shcherbina opened this issue Feb 8, 2018 · 16 comments

Comments

@Vlad-Shcherbina
Copy link

To reproduce:

  1. Download rustup-init.exe from https://www.rustup.rs/.
  2. Run it to install Rust.
  3. Run rustup --version.

Expected: this command to print its version ("rustup 1.10.0 (c6a8f7c 2018-01-25)") and exit instantly.

Actual behavior: this command takes about one second to print version and exit.


To investigate, I tried building rustup from source. I ran the following commands:

git clone git@github.com:rust-lang-nursery/rustup.rs.git
cd rustup.rs
cargo build --release
copy .\target\release\rustup-init.exe .\rustup.exe

And then

.\rustup.exe --version

Locally built rustup starts up instantly. The size of the executable is 6MB (for comparison, the official download is 13MB). Could it be that the official download was produced for the wrong configuration (debug build or something)?

I used the following compiler to build it:

> rustc --version --verbose
rustc 1.25.0-nightly (29c8276ce 2018-02-07)
binary: rustc
commit-hash: 29c8276cee4a0eab7e0634ff25c6b47bd9f87c6c
commit-date: 2018-02-07
host: x86_64-pc-windows-msvc
release: 1.25.0-nightly
LLVM version: 4.0
@steffengy
Copy link
Contributor

Possibly related to rust-lang/cargo#5028.
Atleast for me locally disabling windows defender makes those commands (including rustup --version) finish immediately, with it enabled it takes a few seconds.

Is that also the case on your end?

@steffengy
Copy link
Contributor

@alexcrichton
Using either:

as rustup.exe is faster (without the noticed delay)
Strangely those binaries are only 5.7 MB while my local rustup 1.10.0 is ~12 MB.

Did we previously ship debug builds or does rustup download another binary for self-update?

@alexcrichton
Copy link
Member

@steffengy whoa interesting! I think the difference you're seeing is MSVC vs MinGW. I think we ship x86_64-pc-windows-gnu binaries by default? If it's true though that MSVC is faster we should certainly change that!

@steffengy
Copy link
Contributor

steffengy commented Feb 12, 2018

@alexcrichton
That doesn't seem to be the issue.

26.01.2018  00:18        13.124.774 rustup.exe
12.02.2018  23:16        13.323.777 rustupgnu.exe

The GNU version is fast too.
https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-gnu/rustup-init.exe

@steffengy
Copy link
Contributor

Seems like the slow version I have locally is the x86 GNU version:
https://static.rust-lang.org/rustup/dist/i686-pc-windows-gnu/rustup-init.exe

which indeed seems much slower.
It might anyways make sense to ship the MSVC instead (or atleast the x64 GNU)

@alexcrichton
Copy link
Member

Ah yes I just checked and we were defaulting to i686-pc-windows-gnu because I believe long ago the MSVC target brought in more dylib dependencies. Nowadays though the MSVC is compiled with the static CRT, so I just switched it to install MSVC by default from the website!

@steffengy
Copy link
Contributor

steffengy commented Feb 12, 2018

That should atleast fix it for new installations.

How do we fix that for existing installations though?
Some users surely will just redownload it, if they find this thread.
But most of them wont and will be stuck on (potentially slow) x86-rustup builds for a long time.

Any better option than making rustup updates prompt for a switch to x86_64 builds on x64-capable systems?

@alexcrichton
Copy link
Member

Nah I think it's definitely a possibility to auto-switch over. I think we could add support for "if you're i686-pc-windows-gnu download i686-pc-windows-msvc instead", I don't believe there are any remaining reasons to use i686-pc-windows-gnu rustup binaries any more

@steffengy
Copy link
Contributor

Interestingly it's really an architecture problem (i686-msvc builds show the same delay).
So I'd lean towards just switching to x64-msvc-builds on x64 systems.

I'll spin up a PR for that tomorrow, if nobody gets to it first :)

@alexcrichton
Copy link
Member

Oh! Sorry I misunderstood. So actually for x86_64 we'll need two fixes. The first is to rustup itself to download the MSVC version in the future, and the second is to rustup.rs (the website) itself. I'm... not sure how do do the latter though. I think I forget how it's even deployed...

@steffengy
Copy link
Contributor

steffengy commented Feb 12, 2018

The first is to rustup itself to download the MSVC version in the future

That's what I plan to submit a PR for.

the second is to rustup.rs (the website) itself

The website currently seems to ship i686-msvc for me.
If we can't figure out how to get that updated soon,
we could first also fallback to just running an update initially after the rustup bootstrap,
(if that isn't the case anyways) which then downloads the appropriate rustup version...

@alexcrichton
Copy link
Member

@steffengy ah yeah the website unconditionally ships one version, and I just updated an nginx rewriting rule to unconditionally return i686-msvc. Somewhere the website links to https://win.rustup.rs and that location needs to be changed to auto-detect 32/64 bit and redirect to links we manufactur (like https://win.rustup.rs/x86_64 or something like that)

@steffengy
Copy link
Contributor

Seems to be deployed via travis (potentially at least):

https://github.com/rust-lang-nursery/rustup.rs/blob/master/ci/prepare-deploy-travis.sh#L54

link at:
https://github.com/rust-lang-nursery/rustup.rs/blob/master/www/index.html#L34

I guess the part with https://win.rustup.rs/x86_64 is something you can also handle via NGINX?

@alexcrichton
Copy link
Member

Oh great! I've just updated win.rustup.rs, so the x86_64 and i686 paths should return the respective binaries

steffengy added a commit to steffengy/rustup.rs that referenced this issue Feb 13, 2018
…t-lang#1353)

Updates on windows will now switch over to host appropriate versions,
ensuring the best user experience (e.g. x86_64 builds on x64).

The website can distinguish between Win64/Win32 builds now and
a new platform can be introduced more easily.
steffengy added a commit to steffengy/rustup.rs that referenced this issue Feb 13, 2018
…t-lang#1353)

Updates on windows will now switch over to host appropriate versions,
ensuring the best user experience (e.g. x86_64 builds on x64).

The website can distinguish between Win64/Win32 builds now and
a new platform can be introduced more easily.
steffengy added a commit to steffengy/rustup.rs that referenced this issue Feb 13, 2018
…t-lang#1353)

Updates on windows will now switch over to host appropriate versions,
ensuring the best user experience (e.g. x86_64 builds on x64).

The website can distinguish between Win64/Win32 builds now and
a new platform can be introduced more easily.
steffengy added a commit to steffengy/rustup.rs that referenced this issue Feb 13, 2018
…t-lang#1353)

Updates on windows will now switch over to host appropriate versions,
ensuring the best user experience (e.g. x86_64 builds on x64).

The website can distinguish between Win64/Win32 builds now and
a new platform can be introduced more easily.
steffengy added a commit to steffengy/rustup.rs that referenced this issue Feb 13, 2018
…t-lang#1353)

Updates on windows will now switch over to host appropriate versions,
ensuring the best user experience (e.g. x86_64 builds on x64).

The website can distinguish between Win64/Win32 builds now and
a new platform can be introduced more easily.
bors added a commit that referenced this issue Feb 13, 2018
windows: detect architecture on website, update to matching arch (#1353)

Updates on windows will now switch over to host appropriate versions,
ensuring the best user experience (e.g. x86_64 builds on x64).

The website can distinguish between Win64/Win32 builds now and
a new platform can be introduced more easily.

r? @alexcrichton
mattico pushed a commit to mattico/rustup.rs that referenced this issue Apr 5, 2018
…t-lang#1353)

Updates on windows will now switch over to host appropriate versions,
ensuring the best user experience (e.g. x86_64 builds on x64).

The website can distinguish between Win64/Win32 builds now and
a new platform can be introduced more easily.
@rbtcollins
Copy link
Contributor

So this seems to be solved yes? We're shipping the MSVC binary by default everywhere? I think we can close this ticket, as making the gnu binary faster isn't a rustup project issue, rather its a rustlang toolchain issue.

@rbtcollins
Copy link
Contributor

I'll take that thumbs up as a yes :).

AJ-Ianozi pushed a commit to AJ-Ianozi/getada-download that referenced this issue Mar 9, 2024
windows: detect architecture on website, update to matching arch (rust-lang#1353)

Updates on windows will now switch over to host appropriate versions,
ensuring the best user experience (e.g. x86_64 builds on x64).

The website can distinguish between Win64/Win32 builds now and
a new platform can be introduced more easily.

r? @alexcrichton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants