Why is my root process so much longer than my other processes?

I’m trying to profile my code with the @profview command in VScode. After ~1000 seconds of running, this is what the profiling gives me:

What could be the reasons root taking so much longer than all my other processes?

I have a function compare_eigenvals(;kwargs...) that I defined myself and I just run the code:

@profview @time Λs_model, Λs_RN =  compare_eigenvals(;kwargs...)

Scrolling down in the profile graph yields:

So except from the big time loss after root, all of the calculation time is used for the function.
I have ran this multiple times, so I don’t think its a compilation problem. I also get 0.59% gc time and 0.13% compilation time.

Do you run julia with multiple threads? I think that empty space are the unused threads, you might try selecting the main thread in that dropdown menu

I checked just the main thread, and that one gives the same distribution as the picture. The other threads don’t give anything.

Some internal functions of external libraries (e.g. OpenBLAS) use peculiar calling conventions which prevent the normal stackframe analysis from assigning their time to the right part of the tree. To see if this is contributing to your case, you can use the “C=true” profile analysis option to show all samples, and name the fallen leaves.

1 Like