Open james7132 opened 2 years ago
Blindly rely on the executor to properly handle parallelization.
I get what you're saying, but just wanted to say the executor does properly handle parallelization. If two systems see an intersection on their .archetype_component_access()
, they definitely aren't disjoint.
That relies on runtime information, though. Not sure if there's a way to statically prove that two systems can't run in parallel.
This is what the current results mean.
// these aren't known until you actually spawn entities and have archetypes
let some_access = some_system.archetype_component_access();
let other_access = other_system.archetype_component_access();
if some_access.is_compatible(other_access) {
// these systems definitely do not conflict
} else {
// these systems definitely conflict
}
let some_access = some_system.component_access();
let other_access = other_system.component_access();
if some_access.is_compatible(other_access) {
// these systems can never conflict
} else {
// these systems may or may not conflict (depends on the archetypes)
}
What problem does this solve or what need does it fill?
To ensure maximum performance, we should be able to test that at least two (if not N) different systems will not block each other during execution (ignoring any explicit labeling or ordering).
What solution would you like?
A testing utility that, given two or more systems, returns false if all of them cannot run in parallel. This would allow using assert tests to ensure that said tests are broken if the systems would serialize execution in any way.
What alternative(s) have you considered?
Blindly rely on the executor to properly handle parallelization.
Additional context
A lot of optimizations that rely on splitting large monolithic systems into smaller disjoint ones that can run in parallel cannot be easily enforced via unit tests right now.