Skip to content

chore: improve performance of indeterminate spinner #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2025

Conversation

ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented Jun 16, 2025

A user reported a constant 10% CPU usage whilst the Cursor svg failed to load. It turns out unnecessarily tying a looping animation to some state in SwiftUI is a bad idea. If you want to render a looping animation that's not tied to some state, you should use the CoreAnimation framework. In this case, we use a CABasicAnimation.

We leave the determinate spinner unmodified, as it by definition must be tied to some SwiftUI state.

Before:
before
After:
after

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ethanndickson ethanndickson marked this pull request as ready for review June 16, 2025 03:53
Copy link
Member Author

ethanndickson commented Jun 16, 2025

Merge activity

  • Jun 16, 2:17 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 16, 2:17 PM UTC: @ethanndickson merged this pull request with Graphite.

@ethanndickson ethanndickson merged commit 9a7b776 into main Jun 16, 2025
4 checks passed
@ethanndickson ethanndickson deleted the ethan/spinner-performance branch June 16, 2025 14:17
@ethanndickson ethanndickson self-assigned this Jun 17, 2025
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.

2 participants