Skip to content

perf: reduce CPU usage by caching progress bar image#6

Open
CoSNaYe wants to merge 1 commit intolion9453:mainfrom
CoSNaYe:fix/reduce-cpu-usage
Open

perf: reduce CPU usage by caching progress bar image#6
CoSNaYe wants to merge 1 commit intolion9453:mainfrom
CoSNaYe:fix/reduce-cpu-usage

Conversation

@CoSNaYe
Copy link
Copy Markdown
Contributor

@CoSNaYe CoSNaYe commented Jan 30, 2026

Summary

  • Extract MenuBarProgressBars as separate Equatable view to prevent unnecessary NSImage regeneration on every render
  • Extract RefreshButton to isolate animation state from parent view, so animation no longer triggers full view tree redraws
  • Fixes high CPU usage (~10%) caused by continuous image regeneration during refresh animation

Test plan

  • Open Activity Monitor and observe CPU usage
  • Click refresh button and verify animation still works
  • Verify CPU usage stays low during refresh (~0-2% instead of 10%+)
  • Verify progress bars still update correctly when usage data changes

Note: Thank you for developing this useful tool!
Since I don't have Swift/macOS development experience, this fix was analyzed and implemented with the help of Claude Code AI. I would really appreciate it if you could review whether this approach is
correct and if there are any potential issues I might have missed.

🤖 Generated with Claude Code

- Extract MenuBarProgressBars as separate Equatable view to prevent
  unnecessary NSImage regeneration on every render
- Extract RefreshButton to isolate animation state from parent view
- Animation no longer triggers full view tree redraws

Fixes high CPU usage (~10%) caused by continuous image regeneration
during refresh animation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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