# \[solved\] Agents.jl spending 3/4 of its time doing something before it even starts to compute?

**URL:** <https://discourse.julialang.org/t/solved-agents-jl-spending-3-4-of-its-time-doing-something-before-it-even-starts-to-compute/44109>\
**Category:** Performance\
**Created:** [August 1, 2020, 9:59pm UTC](https://discourse.julialang.org/t/solved-agents-jl-spending-3-4-of-its-time-doing-something-before-it-even-starts-to-compute/44109 "2020-08-01T21:59:26Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![Pbellive](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pbellive/32/3604_2.png) [@Pbellive](https://discourse.julialang.org/u/Pbellive)\
**Post date:** [August 3, 2020, 2:52am UTC](https://discourse.julialang.org/t/solved-agents-jl-spending-3-4-of-its-time-doing-something-before-it-even-starts-to-compute/44109/10 "2020-08-03T02:52:11Z")

</div>

> [@dlakelan](#):
>
> Now that I think about it, I’ve got 4 julia threads in my environment variable, so maybe it’s sampling all 4 threads, and of course 3/4 of them are not doing anything, because I’m not using threads in my code.
> 
> That must be it?

Yeah that’s probably it. The julia profiler seems to do some funny things when julia is launched with multiple threads. See the following thread for a related example:

> [@Profiling code reveals that most time is used calling 3 functions in task.jl](https://discourse.julialang.org/t/profiling-code-reveals-that-most-time-is-used-calling-3-functions-in-task-jl/30751):
>
> I profiled my call to a function and got the following plot: Those first 3 long horizontal lines are calls to task\_done\_hook, then wait, then poptaskref (in ascending order). This happens even for the 2nd or 3rd call to my function, and I don’t understand what they could be. I stopped specifying a lot of the types used / returned in my functions after a while since I was losing time doing so properly - could this be the cause? How could I find out?

---

_[View the full topic](https://discourse.julialang.org/t/solved-agents-jl-spending-3-4-of-its-time-doing-something-before-it-even-starts-to-compute/44109)._
