Repository navigation
fix(app): play the dashboard's looping animations in Core Animation - #108
Merged
Merged
Conversation
The open dashboard used 9 to 17% CPU while it was in front. The pinging status dots and the moving dashes on the Power card were TimelineViews at 30 frames a second, and each frame had SwiftUI update the window's layers and send the whole layer tree to the window server. Play both as Core Animation layer animations instead, which the window server runs without the app. They keep 30 frames a second and stop while the window is hidden or another app is in front, so the window server does no more work than before. In the demo build with the window in front, the app goes from 13% to 2% CPU. Refs #90 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 27, 2026
Merged
yogeshprasad098
added a commit
that referenced
this pull request
Nov 27, 2026
…108) The open dashboard used 9 to 17% CPU while it was in front. The pinging status dots and the moving dashes on the Power card were TimelineViews at 30 frames a second, and each frame had SwiftUI update the window's layers and send the whole layer tree to the window server. Play both as Core Animation layer animations instead, which the window server runs without the app. They keep 30 frames a second and stop while the window is hidden or another app is in front, so the window server does no more work than before. In the demo build with the window in front, the app goes from 13% to 2% CPU. Refs #90
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #90
With 0.3.2, the open dashboard still used 9 to 17% CPU while it was in front: 17% on Overview, about 9% on every other page. The pinging status dots (the sidebar's "Helper running" dot is on every page) and the moving dashes on the Power card were TimelineViews at 30 frames a second. A sample of the installed 0.3.2 showed each frame spent in SwiftUI updating the window's layers and in
CA::Transaction::commit, sending the whole layer tree to the window server.Both are now Core Animation layer animations (
App/Design/LayerAnimations.swift), which the window server plays without the app. They keep 30 frames a second, stay in step across copies, and stop while the window is hidden or another app is in front, as before. Reduce Motion still stills them.Review focus
The first try left the animations running at the display's rate and while the window was inactive, and the window server went from 18% to 38% CPU. Capping them at 30 frames a second with
preferredFrameRateRangeand stopping them when the window is inactive brought it back to where it was. The ring is hidden, not frozen mid-ping, while it is stopped.Testing
Tested on an M3 MacBook Air, macOS 27.2.1, Debug build with
--demo, Overview in front then behind Finder, CPU frompsover 20 s:--live-readings--live-readingsThe window server idles at about 15% on this Mac with nothing of ours open. Screenshots taken 0.3 s apart show the dashes moving and both status dots pinging in step; the design renders show the dashes in light and dark.
./scripts/check.shpasses.Not tested: the release build with real readings. I'll measure it on the installed app after the release.
CHANGELOG.mdhas an entry under Unreleased saying what a user now sees, or nothing user-visible changed.!in the title and the migration above.