async-executor icon indicating copy to clipboard operation
async-executor copied to clipboard

Wake up threads more aggressively if there is known work to do

Open james7132 opened this issue 1 year ago • 3 comments

Upon investigating https://github.com/bevyengine/bevy/issues/6941, we've found that thread wakeup times have been a significant bottleneck when spinning up large batches of tasks, like those mentioned in #91.

Would it be possible to more aggressively wake up threads (i.e. 2+ at a time), if and only if we know there is sufficient work for all of them? Whenever a thread is stealing work from another, it has an approximation of how much remaining work is in both threads, so it may be reasonable to weigh the potential contention against the cost of sequentially context switches as threads wake up.

james7132 avatar Feb 19 '24 00:02 james7132