Skip to content

Commit

Permalink
Merge pull request #3837 from vigo2/vigo/simple-perf-measures
Browse files Browse the repository at this point in the history
Simple-perf-measures
  • Loading branch information
vigo2 authored Oct 9, 2023
2 parents 8954ff0 + 5d8277e commit 1b855ff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 32 deletions.
25 changes: 7 additions & 18 deletions sim/core/aura.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ func (aura *Aura) Refresh(sim *Simulation) {
aura.expires = NeverExpires
} else {
aura.expires = sim.CurrentTime + aura.Duration
aura.Unit.minExpires = 0
if aura.expires < aura.Unit.minExpires {
aura.Unit.minExpires = aura.expires
}
}
}

Expand Down Expand Up @@ -285,7 +287,7 @@ type auraTracker struct {
// IDs of Auras that may expire and are currently active, in no particular order.
activeAuras []*Aura

// caches the minimum expires time of all active auras; reset to 0 on Activate(), Deactivate(), and Refresh()
// caches the minimum expires time of all active auras; might be stale (too low) after Deactivate().
minExpires time.Duration

// Auras that have a non-nil XXX function set and are currently active.
Expand All @@ -302,20 +304,9 @@ type auraTracker struct {

func newAuraTracker() auraTracker {
return auraTracker{
resetEffects: []ResetEffect{},
ExclusiveEffectManager: &ExclusiveEffectManager{},
activeAuras: make([]*Aura, 0, 16),
onCastCompleteAuras: make([]*Aura, 0, 16),
onSpellHitDealtAuras: make([]*Aura, 0, 16),
onSpellHitTakenAuras: make([]*Aura, 0, 16),
onPeriodicDamageDealtAuras: make([]*Aura, 0, 16),
onPeriodicDamageTakenAuras: make([]*Aura, 0, 16),
onHealDealtAuras: make([]*Aura, 0, 16),
onHealTakenAuras: make([]*Aura, 0, 16),
onPeriodicHealDealtAuras: make([]*Aura, 0, 16),
onPeriodicHealTakenAuras: make([]*Aura, 0, 16),
auras: make([]*Aura, 0, 16),
aurasByTag: make(map[string][]*Aura),
resetEffects: []ResetEffect{},
ExclusiveEffectManager: &ExclusiveEffectManager{},
aurasByTag: make(map[string][]*Aura),
}
}

Expand Down Expand Up @@ -664,8 +655,6 @@ func (aura *Aura) Deactivate(sim *Simulation) {
aura.Unit.activeAuras[removeActiveIndex].activeIndex = removeActiveIndex
}
aura.activeIndex = Inactive

aura.Unit.minExpires = 0
}

if aura.onCastCompleteIndex != Inactive {
Expand Down
14 changes: 1 addition & 13 deletions sim/core/character.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,18 +345,6 @@ func (character *Character) AddPet(pet PetAgent) {
character.Pets = append(character.Pets, pet.GetPet())
}

func (character *Character) MultiplyMeleeSpeed(sim *Simulation, amount float64) {
character.Unit.MultiplyMeleeSpeed(sim, amount)
}

func (character *Character) MultiplyRangedSpeed(sim *Simulation, amount float64) {
character.Unit.MultiplyRangedSpeed(sim, amount)
}

func (character *Character) MultiplyAttackSpeed(sim *Simulation, amount float64) {
character.Unit.MultiplyAttackSpeed(sim, amount)
}

func (character *Character) GetBaseStats() stats.Stats {
return character.baseStats
}
Expand Down Expand Up @@ -523,7 +511,7 @@ func (character *Character) advance(sim *Simulation) {

for _, pet := range character.Pets {
if pet.enabled {
pet.advance(sim)
pet.Unit.advance(sim)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion sim/core/sim.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ func (sim *Simulation) reset() {
sim.Duration += time.Duration(sim.RandomFloat("sim duration")*float64(variation)) - sim.DurationVariation
}

sim.pendingActions = make([]*PendingAction, 0, 64)
sim.pendingActions = sim.pendingActions[:0]

sim.executePhase = 0
sim.nextExecutePhase()
Expand Down

0 comments on commit 1b855ff

Please sign in to comment.