Skip to content

Make FrameUtil.ApplyFont lazy - #109

Merged
argium merged 2 commits into
mainfrom
copilot/performance-improvements
Jul 6, 2026
Merged

Make FrameUtil.ApplyFont lazy#109
argium merged 2 commits into
mainfrom
copilot/performance-improvements

Conversation

@argium

@argium argium commented Jul 6, 2026

Copy link
Copy Markdown
Owner

FrameUtil.ApplyFont runs on hot bar/icon refresh paths (power/aura updates, extra icon cooldown refreshes) and reapplied identical SetFont/SetShadowColor/SetShadowOffset on every call.

Changes

  • Lazy setter application: fontMatches/shadowMatches compare resolved settings against live FontString state and short-circuit redundant setter calls.
  • Direct Retail getters: matching reads GetFont/GetShadowOffset/GetShadowColor directly — no if fontString.GetX then guards, no __ecmFont* shadow cache that could drift from live UI state.
  • Test double models Retail: the FontString spy now stores live state and exposes the getters, defaulting shadow offset to Retail's 0,0.

Notes

Because a fresh FontString already sits at the 0,0 no-shadow default, the lazy path correctly skips the redundant SetShadowOffset(0,0); affected tests now assert effective state rather than setter call counts. Added coverage for the shadow-enabled path (SetShadowColor/SetShadowOffset applied once across repeated calls).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 6, 2026 00:25

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a2394cc044

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread FrameUtil.lua

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes FrameUtil.ApplyFont by making font/shadow application “lazy”, avoiding redundant SetFont, SetShadowColor, and SetShadowOffset calls when the resolved settings haven’t changed. This targets hot refresh paths (bars/icons) to reduce per-refresh work.

Changes:

  • Added fontMatches / shadowMatches helpers and early-exit logic in FrameUtil.ApplyFont to skip redundant setter calls.
  • Introduced per-fontstring caching (__ecmFont*) as a fallback when live getters aren’t available.
  • Added a new unit test verifying repeated calls don’t reapply unchanged font settings.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
FrameUtil.lua Adds lazy font/shadow matching and skips redundant setter calls in ApplyFont.
Tests/Utilities_spec.lua Adds coverage ensuring repeated ApplyFont calls don’t repeatedly call setters for unchanged settings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Tests/Utilities_spec.lua Outdated
@argium

argium commented Jul 6, 2026

Copy link
Copy Markdown
Owner Author

@copilot resolve

Copilot AI commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve

Added a second test that enables globalConfig.fontShadow = true and asserts SetShadowColor/SetShadowOffset are each called only once across repeated ApplyFont calls, exercising the shadow skipping behavior.

Copilot finished work on behalf of argium July 6, 2026 06:28
Copilot AI changed the title Make font application lazy Make FrameUtil.ApplyFont lazy Jul 6, 2026
Copilot finished work on behalf of argium July 6, 2026 06:44
@argium
argium force-pushed the copilot/performance-improvements branch from 724b7a2 to 2d575b4 Compare July 6, 2026 15:51
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Results

945 tests  +1   945 ✅ +1   2s ⏱️ ±0s
  4 suites ±0     0 💤 ±0 
  4 files   ±0     0 ❌ ±0 

Results for commit 2d575b4. ± Comparison against base commit 7ac2da4.

@argium
argium merged commit ff27578 into main Jul 6, 2026
2 checks passed
@argium
argium deleted the copilot/performance-improvements branch July 6, 2026 15:53
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.

3 participants