I have tried and failed to find why the utilization of my 32 threaded cpu is so bad when I run the test for rustc “./x.py test”.
Think that I have reduced it to be the “rustdoc test” execution that is my problem. But I do not know why feels like something that can be crazy parallel.
when I hade looked at the code and did not understand why it was not using more of my threads I tested with some different values of the environment variable RUST_TEST_THREADS and when I have it set to 6 the execution time is half of the time for the default value of 32.
If someone have any thoughts about how to find the problem I can try to make some test but I have no ideas how to improve this.
EDIT: I have now tested on my laptop that have 4 threads and then the difference is not that big but I still get some faster times if I set RUST_TEST_THREADS to less than the number of threads the cpu support but more than 1 and the cpu is at around 60% utilization.
I also noticed that I forgot to state that the cpu utilization is at around 17% for the 32 thread cpu.
the solution that rustdoc test is using now is that each test is compiled by it self so for libstd 899 separate compilations is triggered and it feels like it shall be able to use all of my cpu not only 17%.