Stream: t-compiler/wg-parallel-rustc

Topic: Profiling Cargo windows


andjo403 (Nov 27 2019 at 21:21, on Zulip):

as you talked about getting some numbers I did a try with my 16core 32 thread cpu with windows.
building cargo@14654f
built rustc@797fd92 with parallel-compiler = true
| Zthreads | total time |
| ------------ | ------------- |
| 1 | 41.62s |
| 2 | 31.92s |
| 4 | 27.34s |
| 8 | 25.00s |
| 16 | 24.69s |
| 32 | 27.42s |

andjo403 (Nov 27 2019 at 21:32, on Zulip):

the numbers is for this command git clean -fdx && set RUSTFLAGS=-Zthreads=N && cargo +stage2 check

Alex Crichton (Nov 28 2019 at 00:51, on Zulip):

Interesting! Looks like windows has similar issues getting slower the more threads it gets

Alex Crichton (Nov 28 2019 at 00:51, on Zulip):

It may mean semaphores aren't as good as we thought

Alex Crichton (Nov 28 2019 at 00:51, on Zulip):

At least on Windows

simulacrum (Nov 28 2019 at 00:53, on Zulip):

hm, so that might be just "windows has other problems" -- I've not done any benchmarking at least on windows

simulacrum (Nov 28 2019 at 00:54, on Zulip):

(it might be that e.g. semaphores are much better, but don't actually solve the problem, since we still see a ton of contention)

Alex Crichton (Nov 28 2019 at 00:56, on Zulip):

Yeah I think we will want to settle the Linux story anyway first

Alex Crichton (Nov 28 2019 at 00:56, on Zulip):

And then we can tackle other platforms if still necessary

andjo403 (Dec 04 2019 at 20:08, on Zulip):

@simulacrum did a local build of https://github.com/rust-lang/rust/pull/67029 and tried the same way as above and the numbers are almost exactly the same with this build

simulacrum (Dec 04 2019 at 20:08, on Zulip):

oh! I was going to ping you when it finished :)

simulacrum (Dec 04 2019 at 20:09, on Zulip):

but that sounds not great

simulacrum (Dec 04 2019 at 20:09, on Zulip):

Do you know how feasible it is to determine how much time is being spent in system vs. userspace?

andjo403 (Dec 04 2019 at 20:10, on Zulip):

I do not know how to do that can try to look around a bit

simulacrum (Dec 04 2019 at 20:11, on Zulip):

that would be amazing; I don't know anything about Windows I'm afraid :)

andjo403 (Dec 04 2019 at 20:14, on Zulip):

what I did yesterday was to try to use WPA that is the gui to windows event tracing and then I see that all the threads is woken at the same time and then there is some delay and then it happens again

simulacrum (Dec 04 2019 at 20:15, on Zulip):

ah

simulacrum (Dec 04 2019 at 20:15, on Zulip):

so that's the behavior we were suspecting we'd see on linux without semaphores

simulacrum (Dec 04 2019 at 20:15, on Zulip):

I guess windows is exhibiting similar behavior then which is ... not great

simulacrum (Dec 04 2019 at 20:16, on Zulip):

(considering we're using semaphores there)

simulacrum (Dec 04 2019 at 20:16, on Zulip):

I wonder if we can pass some flag or something

andjo403 (Dec 04 2019 at 20:16, on Zulip):

can try to see if I can see the same for the new build.
but I do not know the tools and things that well so maybe I miss read the logs

simulacrum (Dec 04 2019 at 20:18, on Zulip):

makes sense

andjo403 (Dec 04 2019 at 20:56, on Zulip):

can not find any way to see the system vs user time in windows and maybe the all wake at the same time is not a problem when I have looked at the self-profile chrome tracing logs the execution is bursty so maybe there only was alot of work to do.

simulacrum (Dec 04 2019 at 20:57, on Zulip):

@andjo403 thanks for doing the legwork here!

andjo403 (Dec 04 2019 at 20:58, on Zulip):

self-profiling log

Alex Crichton (Dec 04 2019 at 20:58, on Zulip):

Unfortunately the only API I know of to get user/kernel times is https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getprocesstimes, but that's very low-level and you'd have to iterate over all processes spawned by Cargo

Alex Crichton (Dec 04 2019 at 20:58, on Zulip):

the cpu time unfortunately won't be too useful because if it's all being spent in the kernel that's not too useful

Alex Crichton (Dec 04 2019 at 20:59, on Zulip):

(which is the problem we had on linux)

Last update: Dec 12 2019 at 00:50UTC