timholy / FlameGraphs.jl

Analysis of profiling data using trees
MIT License
51 stars 12 forks source link

most of the runtime is in task_done_hook unless threads = 1 #40

Closed tpapp closed 3 years ago

tpapp commented 3 years ago

MWE: start julia with eg -t 4, then in

using ProfileView
f(n) = [sum(randn(100)) for _ in 1:n]
f(1)
@profview f(10^5)

In the resulting flamegraph, most of the time is spent in task_done_hook (nesting wait, poptask).

Starting as julia -t 1 is a workaround.

ProfileView 0.6.10; FlameGraphs 0.2.5; julia 1.6, 1.7, master.

I am opening an issue here because I am not sure if this is something to do with Julia's profiling infrastructure or this package, please move if necessary.

Possibly post-processing the results could solve this issue? Cf discussion.

timholy commented 3 years ago

It's definitely a Julia issue; just use

using Profile
@profile f(10^5)
Profile.print()

and observe all the counts at the bottom for task_done_hook. (Without loading ProfileView.)

tpapp commented 3 years ago

Thanks, closing in favor of JuliaLang/julia#41713.