Skip to main content

step_scratch

Function step_scratch 

Source
pub fn step_scratch(
    peds: &mut [Pedestrian],
    walls: &[WallSegment],
    params: &Params,
    dt: f64,
    scratch: &mut Scratch,
)
Expand description

Zero-allocation step variant. Reuses scratch.buf and rebuilds scratch.grid against peds, then runs the same math as step_with_grid without any per-tick allocation.

This is the hot-path variant: allocate one Scratch per simulation and call step_scratch every tick. Allocation-sensitive callers (ECS integration, real-time 30–60 Hz loops) should prefer this over step / step_with_grid.