Skip to content

Small performance optimization#14820

Open
benprew wants to merge 1 commit intomagefree:masterfrom
benprew:optimize-continuous-effects
Open

Small performance optimization#14820
benprew wants to merge 1 commit intomagefree:masterfrom
benprew:optimize-continuous-effects

Conversation

@benprew
Copy link
Copy Markdown

@benprew benprew commented Apr 30, 2026

Summary

Performance improvements to ContinuousEffects layer processing:

  • Use HashSet for O(1) effect ID lookups in updateTimestamps
  • Replace stream with loop in filterLayeredEffects
  • Cache ability lookups across PT sublayer passes
  • Return static empty set from getAbility instead of allocating

Includes regression tests.

Profiled with JDK Mission Control on MacOS Tahoe 26 (M1 Air)

Before (lots of time in ApplyEffect):
Screenshot 2026-04-24 at 3 20 05 PM

After (less time spent in ApplyEffect):
Screenshot 2026-04-24 at 3 21 01 PM

Performance improvements to ContinuousEffects layer processing:
- Use HashSet for O(1) effect ID lookups in updateTimestamps
- Replace stream with loop in filterLayeredEffects
- Cache ability lookups across PT sublayer passes
- Return static empty set from getAbility instead of allocating
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant