mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 09:33:51 +00:00
perf: entity/skill/DBC/warden maps to unordered_map; fix 3x contacts scan
Entity storage: std::map<uint64_t, shared_ptr<Entity>> → unordered_map for O(1) entity lookups instead of O(log n). No code depends on GUID ordering. Player skills: std::map<uint32_t, PlayerSkill> → unordered_map. DBC ID cache: std::map<uint32_t, uint32_t> → unordered_map. Warden: apiHandlers_ and allocations_ → unordered_map (freeBlocks_ kept as std::map since its coalescing logic requires ordered iteration). Contacts: handleFriendStatus() did 3 separate O(n) find_if scans per packet. Consolidated to single find_if with iterator reuse. O(3n) → O(n).
This commit is contained in:
parent
2af3594ce8
commit
e61b23626a
5 changed files with 20 additions and 21 deletions
|
|
@ -1106,7 +1106,7 @@ public:
|
|||
uint32_t getOverrideLightTransMs() const { return overrideLightTransMs_; }
|
||||
|
||||
// Player skills
|
||||
const std::map<uint32_t, PlayerSkill>& getPlayerSkills() const { return playerSkills_; }
|
||||
const std::unordered_map<uint32_t, PlayerSkill>& getPlayerSkills() const { return playerSkills_; }
|
||||
const std::string& getSkillName(uint32_t skillId) const;
|
||||
uint32_t getSkillCategory(uint32_t skillId) const;
|
||||
bool isProfessionSpell(uint32_t spellId) const;
|
||||
|
|
@ -3502,7 +3502,7 @@ private:
|
|||
uint32_t overrideLightTransMs_ = 0;
|
||||
|
||||
// ---- Player skills ----
|
||||
std::map<uint32_t, PlayerSkill> playerSkills_;
|
||||
std::unordered_map<uint32_t, PlayerSkill> playerSkills_;
|
||||
std::unordered_map<uint32_t, std::string> skillLineNames_;
|
||||
std::unordered_map<uint32_t, uint32_t> skillLineCategories_;
|
||||
std::unordered_map<uint32_t, uint32_t> spellToSkillLine_; // spellID -> skillLineID
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue