mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-08-01 02:11:51 -04:00
OpcodeTable::toWire was an unordered_map<uint16_t, uint16_t>::find() called from ~300 sites (some per-frame on movement opcode construction). LogicalOpcode is a dense uint16_t enum, so back the mapping with a plain std::vector<uint16_t> sized to max-seen and indexed directly. toWire() becomes a bounds check + one array read instead of hash + bucket walk. Loading still goes through an unordered_map scratch to let the recursive _extends/_remove loader work unchanged; the result is baked into the flat vector once at load time. fromWire stays a map since wire values are sparse across the 0..0xFFFF range.
2.8 KiB
2.8 KiB