Files
WoWee/include/game
Kelsi ef52065c71 perf(packets): replace std::map field storage with sorted flat vector
UpdateBlock::fields and Entity::fields were both std::map<uint16_t,
uint32_t>. Every UPDATE_OBJECT packet allocated one red-black-tree
node per parsed field (typically ~20 fields × dozens of blocks per
packet), trashing the allocator and producing pointer-chained
iteration on every consumer scan.

Introduce FlatFieldMap (include/game/flat_field_map.hpp): a sorted
std::vector<std::pair<uint16_t, uint32_t>> wrapper with the same
iterator-based API the existing 50+ call sites use — find(), end(),
operator[], range-for, ->first/->second on iterators. The parser
walks the bitmask low-to-high so append_sorted() is O(1) amortized;
Entity::setField falls back to insert_or_assign which is O(log N)
search + O(N) shift but N is small (~60 fields per entity).

Switched every signature on the path:
- UpdateBlock::fields, Entity::fields storage
- extractContainerFields / detectInventorySlotBases /
  applyInventoryFields / updateOtherPlayerVisibleItems
- detectPlayerMountChange / maybeDetectCoinageIndex /
  applyPlayerStatFields / extractPlayerAppearance
- extractSkillFields / extractExploredZoneFields /
  applyQuestStateFromFields
- lastPlayerFields_ snapshot
2026-05-14 13:06:22 -07:00
..