[GH-ISSUE #1221] Mob pushes in a crowded pen cost the square of the crowd #312

Closed
opened 2026-11-02 15:38:06 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @pirut on GitHub (Oct 22, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/1221

In a crowded pen where every mob pushes its neighbours, the push bookkeeping grows with the square of the crowd for each mob. Pending pushes wait in one list, each mob's tick scans the whole list, and take_mob_pushes removes each push from the events in place, shifting the rest:

30 mobs pushing each other:  0.11 ms per tick
100 mobs pushing each other: 1.73 ms per tick
200 mobs pushing each other: 9.07 ms per tick
Originally created by @pirut on GitHub (Oct 22, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/1221 In a crowded pen where every mob pushes its neighbours, the push bookkeeping grows with the square of the crowd for each mob. Pending pushes wait in one list, each mob's tick scans the whole list, and `take_mob_pushes` removes each push from the events in place, shifting the rest: 30 mobs pushing each other: 0.11 ms per tick 100 mobs pushing each other: 1.73 ms per tick 200 mobs pushing each other: 9.07 ms per tick
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#312
No description provided.