Skip to content

Perf: skip status display rebuild when values unchanged#316

Closed
Mere-Solace wants to merge 1 commit into
devfrom
perf/status-display-cache-300
Closed

Perf: skip status display rebuild when values unchanged#316
Mere-Solace wants to merge 1 commit into
devfrom
perf/status-display-cache-300

Conversation

@Mere-Solace

Copy link
Copy Markdown
Owner

Summary

Cache previous display shards and toughness values in SwordEntity to skip Component/String allocations when values haven't changed.

Details

  • Added prevDisplayShards (int, init -1) and prevDisplayToughness (float, init -1f) cache fields
  • updateStatusDisplayText() now reads current values, compares against cache, and returns early if unchanged
  • Cache updated before building display text on actual changes

Closes #300

Cache prevDisplayShards and prevDisplayToughness on SwordEntity; return early from updateStatusDisplayText() when neither value has changed, eliminating ~700 Component allocations per second at 35 entities.
@Mere-Solace Mere-Solace added priority: medium Medium priority size: s Small, a few hours type: performance Performance optimization and efficiency labels Apr 2, 2026
@Mere-Solace Mere-Solace self-assigned this Apr 2, 2026
@Mere-Solace Mere-Solace force-pushed the perf/status-display-cache-300 branch from 5acb02f to 7c9430c Compare April 2, 2026 01:21
@Mere-Solace

Copy link
Copy Markdown
Owner Author

Changes merged directly into dev via cherry-pick. Closing.

@Mere-Solace Mere-Solace closed this Apr 2, 2026
@Mere-Solace Mere-Solace deleted the perf/status-display-cache-300 branch April 2, 2026 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: medium Medium priority size: s Small, a few hours type: performance Performance optimization and efficiency

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant