Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add count of tasks scheduled to time macro #55094

Conversation

IanButterworth
Copy link
Member

$ julia -t6 -q
julia> x = zeros(100);

julia> @time for i in x
           i
       end
  0.007487 seconds (4.00 k allocations: 204.148 KiB, 98.58% compilation time: 41% of which was recompilation)

julia> @time Threads.@threads for i in x
           i
       end
  0.046984 seconds (43.01 k allocations: 2.156 MiB, 7 tasks scheduled, 156.00% compilation time: 6% of which was recompilation)

julia> @time for i in x
           Threads.@spawn i
       end
  0.010576 seconds (5.74 k allocations: 295.383 KiB, 100 tasks scheduled, 96.17% compilation time: 60% of which was recompilation)

Might be too noisy for @time as tasks scheduled in itself isn't a bad thing to flag.. task switches instead?

@jpsamaroo
Copy link
Member

Maybe @time could gain a flag to enable extra features like this? I personally would use both tasks scheduled and task switches when timing Dagger code, but that may be too noisy in general.

@IanButterworth
Copy link
Member Author

Talking through this at juliacon the idea came up of instead showing if >10% of time was spent waiting on the scheduler.
Scheduling tasks itself isn't a bad thing, nor something that the user might want to minimize, so it's not a good fit compared to other metrics.

Reporting if >10% time was spent waiting on the scheduler seems like a generally suboptimal thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants