Profiling code reveals that most time is used calling 3 functions in task.jl

If you are on macOS, unfortunately recent macOS changes have caused julia’s profile unwinding to mostly fail.

If not, it could be that you’re not viewing the specific thread that work is being done?
Profile.@profile and Profile.print(groupby=:thread) is one way to show by thread.

2 Likes

I am on Linux. But I think you are right. On the top left of the flame graph that ProfileCanvas shows me there is a menu where I can choose threads. By default it shows all, but it gives the possibility of choosing different threads. If I choose 1, the bar corresponding to poptask disappear and only the eval one remains. If I choose anything else from 2 to 6, than only the poptask is shown. It is also the case that \frac{100}{6} \approx 17, which would also explain the percentages I get when the all option is selected.
In conclusion, it does seem like there is no problem at all and everything is working as expected. Sorry for bringing up again this old question for nothing and thank you for the quick reply.

Does the dropdown mention the word “thread”? Could the UI be clearer?

It does. Here are some quick screenshots.



At the moment, I do not have any suggestion on how to make this UI clearer. I would say the main problem was with me knowing nothing about profiling and threads: all of my knowledge comes from this page of the documentation (and I have found the reference to ProfileCanvas.jl here).

I think it might be helpful to have an additional short paragraph in the Profiling page of the documentation I linked above, something mentioning that this is the kind of information one gets when one deals with multiple threads. Maybe one should also consider that the defaults (at least on my computer, but I think I did not make any changes from the standard installation) are that writing julia in the terminal launches it with only one thread (the output of Threads.nthreads() is 1), whereas by default IIRC Pluto runs with half the number of threads the computer has available. An inexperienced user could wonder why the results in the REPL and in the notebook would appear different.

However I would not feel comfortable writing it myself (again because of my absolute lack of knowledge on the topic).

I’d happily review doc improvement attempts :slight_smile: