-
Notifications
You must be signed in to change notification settings - Fork 12
Description
What problem does this solve or what need does it fill?
Bevy currently has three isolated thread pools, "compute", "async compute", and "IO", and allocates 50%, 25%, and 25% of the CPU cores to each pool. In addition to that, it runs one main thread and one rendering thread.
Most of the time, the async compute and IO pools are idle, so Bevy is only using half of the cores (plus one or two, if the main or render threads are working). The simplest solution would be to consolidate them into a single pool, but then background work like asset loading can wind up using all the threads, leaving none for foreground work!
What solution would you like?
Support task priorities, so that we can run a single task pool but not have background work block progress on foreground work.
I don't know enough about realistic use cases to know how much complexity is necessary here! It may be enough to have two hard-coded priorities for "foreground" and "background" tasks, but we may need more.
It may be enough to let any worker take any task and just prefer foreground ones. But we may need to ensure that some workers cannot run background tasks, so that they are available immediately when foreground tasks are spawned. And may need to have some workers prefer background tasks so that background work can still make progress under heavy load.