pub struct SystemScheduler { /* private fields */ }Expand description
DAG scheduler that runs systems in topological order with boolean propagation.
Created by SchedulerInstaller via
WorldBuilder::install_driver.
This is a user-space driver — the caller decides when and whether
to call run.
§Propagation
Root systems (no upstream) always run. Non-root systems run only if
at least one upstream returned true.
§Bitmask implementation
Each system occupies one bit position in a u64. During
run, a local results: u64 accumulates which systems
returned true. Each system’s upstream check is:
mask == 0 → root, always run
(mask & results) != 0 → at least one upstream returned trueOne load, one AND, one branch per system — no heap access for the
propagation check itself. The results bitmask lives in a register
for the duration of the loop.
Implementations§
Source§impl SystemScheduler
impl SystemScheduler
Sourcepub fn run(&mut self, world: &mut World) -> usize
pub fn run(&mut self, world: &mut World) -> usize
Run all systems with boolean propagation.
Iterates systems in topological order. For each system:
- Root (
upstream_mask == 0): always runs. - Non-root (
upstream_mask & results != 0): runs if any upstream returnedtrue. Skipped otherwise. - If the system runs and returns
true, its bit is set inresults, enabling downstream systems to run.
The results bitmask is a local u64 — the entire propagation
state fits in a single register. Per-system overhead is one
load + one AND + one branch (~4 cycles).
Does NOT call next_sequence — the global
sequence is event-only.
Returns the number of systems that actually ran.