perf(app): cache MenuBarIcon animation frames at startup#38
Merged
Conversation
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:).
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).
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.
Summary
BadgeKind× frame combinations (~30 images) once at app launchimage(badge:animationFrame:)now returns cachedNSImageinstances instead of allocating a new one on every 0.4s timer tickWhy
The animation timer fires 2.5x/second during active states. Previously each tick created a new
NSImageviaNSImage(size:flipped:drawingHandler:). Over hours this contributes to unnecessary object churn. With caching, zero allocations occur after startup.Test plan
MenuBarIconTestspass