mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-08-02 02:41:11 -04:00
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.