-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Options for disabling all parallelism for single-threaded performance #6689
Description
What problem does this solve or what need does it fill?
In certain environments, like low cost VPS game hosting, it is often more efficient to host multiple single threaded game instances instead of hosting. For these use cases, the additional synchronization overhead of many Send/Sync types can be quite high, particularly with atomics.
What solution would you like?
A feature flag on bevy_ecs and bevy_tasks to:
- disable the
ParallelExecutoras a default runner - the multi-threaded
TaskPool - internally replace
Query::par_for_eachcalls withfor_each. - switch to using
!Sendor!Syncoptions of common types (i.e.Mutex->RefCell,Arc->Rc) (questionable if this is possible, we already avoid the use of these).
In these target environments, rendering is typically not required. Ideally this shouldn't require too much code change on the user's end other than changing some crate features so that code can be easily shared between client and server.
What alternative(s) have you considered?
Leave it as is, eat the cost of atomics in these systems.
Additional context
Original discussion: https://www.reddit.com/r/rust/comments/ytiv2a/comment/iw4q6ed/?utm_source=share&utm_medium=web2x&context=3