Skip to content

Desktop: nothing redraws when idle, cheaper theme changes (#474) - #489

Merged
MopigamesYT merged 3 commits into
perf/auditfrom
perf/474-idle-themes
Nov 17, 2026
Merged

MopigamesYT merged 3 commits into
perf/auditfrom
perf/474-idle-themes

Conversation

@MopigamesYT

Copy link
Copy Markdown
Member

Part of #474. Stacked on perf/audit (#477 audit, not merged yet).

What changes

  • Idle redraw: the caret blink no longer refreshes the whole window, and it stops after inactivity. The frame hook is no longer a never-ending fyne.Animation. Patched in the vendored Fyne: cursor animation, common canvas, driver refresh counter.
  • Theme/accent: a new ResetThemeColourCaches drops only the themed icons and keeps the measured text sizes, which are keyed by font and size. ThemeOverride now resets caches once per apply instead of once per descendant widget (thousands under the transcript). When the fonts are unchanged, repaint keeps the text that was already shaped.
  • Theme watcher: fsnotify replaces the 1 s poll forever. It falls back to a 5 s poll when notifications are unavailable.

Measured on VM 111 (llvmpipe, 4,000 rows / 200 chats)

Metric Before After Target
Idle steady state, composer focused (frames / 10 s) 76–82 0 0 ✅
Idle steady-state CPU 33.6 % 0.9 % ~0 ✅
idle 10 s incl. startup, plain 83 frames, 21.6 % 36 frames, 9.8 %
idleblur, plain 5 frames, 2.2 % 0 frames, 1.1 % 0 ✅
setAccent p50 / p99 216 / 292 ms 77 / 132 ms ≤ 16 ms ❌
Theme span allocs/frame 524k 316k
Theme span CPU 96 % 49 %
Animated shader (aurora), focused 33 fps, 128 % 31 fps, 114 % ⚠️ not addressed

Not done (follow-ups in #474)

  • Shader: no pause when unfocused or occluded, and no reduced-resolution rendering yet. The aurora numbers above are with the window focused.
  • Blur (Settings: themes can blur the sidebar, panel, composer, headers, menus and dialogs; shaders get iMouse (#464) #472, not merged): with a static background, nothing redraws when idle (idleblur 0 frames). No blur-specific caching.
  • Theme switching still takes ~77 ms per accent change, well over one frame. A palette change that only re-colours would need the sidebar and transcript to stop rebuilding.
  • Painter batching and dirty regions: not attempted.

Checks: gofmt clean, go vet and go test ./internal/ui/ pass. The touched Fyne packages have no tests.

Assisted-by: Claude Opus 5.5 low

🤖 Generated with Claude Code

The caret blink and the frame hook kept the window repainting at 8 fps
forever with the composer focused. The caret now blinks without a full
window refresh and stops after inactivity; the frame hook is no longer a
never-ending fyne.Animation. Patches the vendored Fyne (third_party/fyne:
widget cursor animation, common canvas, driver refresh counter).

Assisted-by: Claude Opus 5.5 low
Fyne cleared the measured text sizes with the icons on every theme
change, and ThemeOverride reset every cache once per widget under it
(thousands for the transcript). A new ResetThemeColourCaches drops the
themed icons only, once per override apply. The theme folder is
watched with fsnotify instead of polled (go.mod: fsnotify now direct).

Assisted-by: Claude Opus 5.5 low
Conflict in glfw/loop.go settings listener: kept both the VariantOnly early return and the KeepFonts cache reset.
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