Skip to content

perf(Core): Optimize damage/heal hot paths and gate Mythic AI#81

Merged
Nyeriah merged 1 commit intomasterfrom
perf/hot-path-optimizations
May 3, 2026
Merged

perf(Core): Optimize damage/heal hot paths and gate Mythic AI#81
Nyeriah merged 1 commit intomasterfrom
perf/hot-path-optimizations

Conversation

@Nyeriah
Copy link
Copy Markdown
Member

@Nyeriah Nyeriah commented May 3, 2026

  • Cache SpellBuff/MeleeBuff OnlyBosses config bools at load time; avoids per-hit string lookups via sConfigMgr->GetOption.
  • Replace mutating NerfInfo[mapId][phase] reads with find()/cached refs to stop std::map::operator[] from inserting empty entries on hot damage/heal paths. Also fixes a silent-insert in the debug branch of ModifySpellDamageTaken when matchingPhase == -1.
  • Switch NerfInfo (outer), SpellNerfOverrides, MythicmodeInstanceData, and Expansion from std::map to std::unordered_map. NerfInfo's inner map stays std::map because GetLowestMatchingPhase relies on ordered iteration.
  • Add ModZoneDifficulty.MythicmodeAI.Enable (default 0) so OnUnitEnterCombat can early-out without doing IsInstanceMythic / MythicmodeAI lookups when the scripted AI is unused.
  • Guard attacker null in the OnlyBosses checks (caster can be null for periodic ticks; matches the existing debug-branch guard).

- Cache SpellBuff/MeleeBuff OnlyBosses config bools at load time;
  avoids per-hit string lookups via sConfigMgr->GetOption.
- Replace mutating NerfInfo[mapId][phase] reads with find()/cached refs
  to stop std::map::operator[] from inserting empty entries on hot
  damage/heal paths. Also fixes a silent-insert in the debug branch
  of ModifySpellDamageTaken when matchingPhase == -1.
- Switch NerfInfo (outer), SpellNerfOverrides, MythicmodeInstanceData,
  and Expansion from std::map to std::unordered_map. NerfInfo's inner
  map stays std::map because GetLowestMatchingPhase relies on ordered
  iteration.
- Add ModZoneDifficulty.MythicmodeAI.Enable (default 0) so
  OnUnitEnterCombat can early-out without doing IsInstanceMythic /
  MythicmodeAI lookups when the scripted AI is unused.
- Guard attacker null in the OnlyBosses checks (caster can be null
  for periodic ticks; matches the existing debug-branch guard).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Nyeriah Nyeriah merged commit 5e2728d into master May 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant