-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Windows: slow rustc startup #8859
Comments
This might explain the regression on windows with the libuv upgrade/bindings to process spawning (http://huonw.github.io/isrustfastyet/buildbot/), I assume it wasn't this slow in the pass, but could you try to see what the time of this is right before the libuv upgrade (f22b4b1)? I don't really know how libuv upgrading could be relevant to runtime relocation, I'm not even sure what that is, but perhaps it's semi-related? |
Actually, it's always been this slow on Windows. |
Oh, nevermind then |
Nominating production ready. |
Ok, my findings so far:
What can be done:
|
Thank you for the thorough explanation! |
Visiting for triage. The plan is to migrate to mingw-w64, which should mitigate this. |
Now that we've switched to mingw-w64 toolchain, |
Should we start using |
Unfortunately |
It looks like this became much, much worse sometime recently (was 3 seconds before I updated my 1-2 weeks old rust) on a warm start
Can someone confirm and maybe mark this as high priority? This causes rust to be very awful to use on Windows due to the build times |
Are you using mingw or mingw-w64? For me |
Normal mingw, I tried to build it on mingw-w64 but was unsuccessful, trying again now |
MinGW64 looks to be pretty much entirely broken, LLVM wont compile against it at all |
I would recommend perhaps reinstalling mingw-w64. All the windows bots are running mingw-w64, so there's it's likely a local problem than a mingw-w64 problem. |
I got it to work, it really needs a guide though, msys2 works fine but the sourceforge project listed as mingw-w64 lacks a bunch of C99 exception stuff, causing LLVM not to build properly (if using the i686-w64-mingw target, which I assume you should, since I get no improvement otherwise) |
My latest result is ~250ms with pseudo-relocs / ~80ms without, i.e. about 66% of rustc startup time is spent doing memory fixups. BTW, the largest offenders, in terms of generated pseudo-relocations, currently are:
|
The other 33% of startup time is spent loading various dlls. Here's a procmon profile of a rustc startup. Delay-loading libraries might help here, though it isn't clear how many of these would be used in a typical compilation anyway. |
@thestinger, I wouldn't call this fixed just yet. vec::PTR_MARKER was just on the the sources of pseudo-relocs. |
If it's not completely fixed by #17081 then we could re-open it. Removing line numbers from |
It isn't obvious to me that fail!() and log!() also are in scope of #17081... |
@vadimcn: The logging comes from the |
Slow pseudo-relocs should be fixed now. |
Okay, maybe Windows is slower, but not this slow.
Profiling shows that roughly 1.6 seconds of this time were spent in function "_pei386_runtime_relocator", which is invoked upon loading of rust runtime libraries. librustc accounts for more than 90% of this time, the rest is mostly in rustllvm.
Apparently this function comes from mingw runtime and performs "runtime pseudo-relocations". Note that it calls VirtualQuery once and VirtualProtect twice per relocated address, so no wonder it's slow!
This is the first time I'm coming across pseudo-relocations. Does anybody here know what exactly they are, and why does librustc have so many of them?
The text was updated successfully, but these errors were encountered: