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

**URL:** <https://discourse.julialang.org/t/why-is-my-root-process-so-much-longer-than-my-other-processes/122673>\
**Category:** Profiling\
**Created:** [November 15, 2024, 11:44am UTC](https://discourse.julialang.org/t/why-is-my-root-process-so-much-longer-than-my-other-processes/122673 "2024-11-15T11:44:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas\_Van\_Giel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thomas_van_giel/32/46737_2.png) [@Thomas\_Van\_Giel](https://discourse.julialang.org/u/Thomas_Van_Giel)\
**Post date:** [November 15, 2024, 11:44am UTC](https://discourse.julialang.org/t/why-is-my-root-process-so-much-longer-than-my-other-processes/122673/1 "2024-11-15T11:44:00Z")

</div>

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:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/f/7/f71977b23f188de27dae3fec15bdea82aa309568.png)

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:

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

```

Scrolling down in the profile graph yields:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/3/f/3f8131b2c6c5a069ae3cece887cdae7587be3d3e.png)

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.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [November 15, 2024, 12:17pm UTC](https://discourse.julialang.org/t/why-is-my-root-process-so-much-longer-than-my-other-processes/122673/2 "2024-11-15T12:17:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Thomas\_Van\_Giel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thomas_van_giel/32/46737_2.png) [@Thomas\_Van\_Giel](https://discourse.julialang.org/u/Thomas_Van_Giel)\
**Post date:** [November 17, 2024, 9:33pm UTC](https://discourse.julialang.org/t/why-is-my-root-process-so-much-longer-than-my-other-processes/122673/3 "2024-11-17T21:33:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ralph\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralph_smith/32/10344_2.png) [@Ralph\_Smith](https://discourse.julialang.org/u/Ralph_Smith)\
**Post date:** [November 18, 2024, 2:59am UTC](https://discourse.julialang.org/t/why-is-my-root-process-so-much-longer-than-my-other-processes/122673/4 "2024-11-18T02:59:22Z")

</div>

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.
