Skip to content

perf(app): cache MenuBarIcon animation frames at startup#38

Merged
pasrom merged 2 commits intomainfrom
perf/cache-menu-bar-icon
Mar 18, 2026
Merged

perf(app): cache MenuBarIcon animation frames at startup#38
pasrom merged 2 commits intomainfrom
perf/cache-menu-bar-icon

Conversation

@pasrom
Copy link
Copy Markdown
Owner

@pasrom pasrom commented Mar 18, 2026

Summary

  • Pre-render all BadgeKind × frame combinations (~30 images) once at app launch
  • image(badge:animationFrame:) now returns cached NSImage instances instead of allocating a new one on every 0.4s timer tick

Why

The animation timer fires 2.5x/second during active states. Previously each tick created a new NSImage via NSImage(size:flipped:drawingHandler:). Over hours this contributes to unnecessary object churn. With caching, zero allocations occur after startup.

Test plan

  • App starts and menu bar icon renders correctly
  • All animation states (recording, transcribing, diarizing, processing) animate as before
  • MenuBarIconTests pass

What: Pre-render all badge/frame combinations once into a static cache
instead of creating a new NSImage on every 0.4s timer tick.

Reasoning:
- Problem: NSImage(size:flipped:drawingHandler:) was called 2.5x/second
  during active states, allocating and releasing objects on every tick.
- Decision: Render all BadgeKind × frameCount images at app launch (~30
  images total) and return cached instances from image(badge:animationFrame:).
@github-actions github-actions bot added the chore Maintenance or non-functional changes label Mar 18, 2026
What: Delete MuteDetector (AX API polling every 0.5s) and the
corresponding applyMuteMask logic in AudioMixer.

Reasoning:
- Problem: MuteDetector polled the accessibility tree at 0.5s intervals
  during every recording, adding steady CPU load even when not in use.
- The feature was only effective for Teams on macOS and required
  Accessibility permission trust — rarely granted in practice.
- Decision: Remove entirely. The echo suppression in AudioMixer already
  handles the most common artifact (hearing yourself in the mix).
@pasrom pasrom merged commit 118a043 into main Mar 18, 2026
6 checks passed
@pasrom pasrom deleted the perf/cache-menu-bar-icon branch March 18, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance or non-functional changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant