Skip to content

add count of tasks scheduled to time macro#55094

Closed
IanButterworth wants to merge 1 commit intoJuliaLang:masterfrom
IanButterworth:ib/time_tasks_scheduled
Closed

add count of tasks scheduled to time macro#55094
IanButterworth wants to merge 1 commit intoJuliaLang:masterfrom
IanButterworth:ib/time_tasks_scheduled

Conversation

@IanButterworth
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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