Files
WoWee/include/game/opcode_table.hpp
Kelsi 7742edd16c perf(opcode): flat-vector lookup for LogicalOpcode → wire
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.
2026-05-14 12:44:31 -07:00

2.8 KiB