Files
WoWee/include
Kelsi c2a8677cf2 perf(m2): find the bone seed by lookup instead of scanning every instance
M2_INSTANCES still took 18.6ms after being time-bounded, which means one
createInstance call cost that on its own. It was the bone seed: to avoid a
pop-in flash, a new instance copies bone matrices from an existing
instance of the same model, and it found one by walking the entire
instance list. With tens of thousands of instances resident that is O(n)
per spawn and O(n squared) across a tile.

Remember one seed instance per model instead. Stale entries — the seed
despawned, or its slot now holds a different model — are detected on use
and dropped, falling through to computing the matrices as before. The map
is cleared wherever instanceIndexById is, since it holds instance ids.
2026-07-31 10:54:26 -07:00
..