Skip to content

perf: skip affect_total in ProcessPunctualStyle (#3106)#3130

Merged
bylins merged 1 commit into
masterfrom
perf/punctual-no-recalc
Apr 11, 2026
Merged

perf: skip affect_total in ProcessPunctualStyle (#3106)#3130
bylins merged 1 commit into
masterfrom
perf/punctual-no-recalc

Conversation

@bylins
Copy link
Copy Markdown
Owner

@bylins bylins commented Apr 11, 2026

Summary

Replace ImposeAffectImposeAffectNoRecalc in ProcessPunctualStyle (2 loops).

affect_total is redundant here because:

  • If victim dies → raw_killreset_affectsaffect_total anyway
  • If victim survives → battle_affect_update recalculates next round

Profiler after CastAffect fix shows Backstab at 5.8ms (96%) — this should help.

Test plan

  • Punctual style effects still apply correctly
  • Haemorrhage affects still work
  • Check profiler output

🤖 Generated with Claude Code

ProcessPunctualStyle applies multiple affects via ImposeAffect in loops,
each triggering an expensive affect_total recalculation. This is wasteful
because:
- If victim dies from the hit, raw_kill → reset_affects calls affect_total
- If victim survives, battle_affect_update recalculates on next round

Switch to ImposeAffectNoRecalc to skip redundant recalculations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bylins bylins force-pushed the perf/punctual-no-recalc branch from e8fc2f7 to cd31952 Compare April 11, 2026 04:45
@bylins bylins merged commit 9aca7da into master Apr 11, 2026
19 checks passed
@bylins bylins deleted the perf/punctual-no-recalc branch April 11, 2026 05:11
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