Repository navigation
perf(finder): speed up right-click menus and reduce heartbeat overhead - #167
Merged
Merged
Conversation
This was referenced Nov 2, 2026
SonneFish
marked this pull request as ready for review
November 2, 2026 06:58
3 of 4 tasks
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
Remove the recurring cold-icon rebuild from Finder’s right-click path and stop retransmitting an unchanged signed menu configuration every 10 seconds.
The original issue was not just a slow first launch: the heartbeat repeatedly invalidated the icon cache, making later right-clicks pay the cold-start cost again. This PR breaks that cycle, preloads expensive workspace lookups, and keeps liveness checks lightweight.
This is the standalone performance portion of #166, targeting
dev.Why right-clicks kept getting slow
Previously, each extension heartbeat caused the host to send the full menu configuration. Receiving that configuration cleared the extension’s entire icon cache. The next menu build then queried application icons synchronously through
NSWorkspace.icon(forFile:)on the menu-building thread.A heartbeat could arrive between consecutive right-clicks, so this work was repeatedly paid during normal use rather than only at startup.
Performance changes
runningpayload; send configuration on changes, explicit requests, or reconnectionPeerActivityWorkspace lookups run in the background. Image resizing, drawing, and cache merging remain on the main thread; background preloading does not call
lockFocus. Menu-build timing remains logged so the standalone change can be measured in a signed Finder extension.Earlier profiling
Profiling recorded during the original combined change in #166 showed:
These historical measurements explain the priority of preserving the cache. They are not a new benchmark or a verified approximately 100× speedup for this standalone PR. Cold-start and steady-state measurements for the current head remain on the validation checklist below.
Acceptance criteria
PeerActivityregression tests.Validation
build-for-testing: the app, Finder extension, and test targets build independently (arm64, code signing disabled).PeerActivitytests cover continuous heartbeats, timeout/reconnection, and explicit disconnection.git diff --checkpasses. Fork-specific signing, bundle identifiers, App Groups, and packaging scripts are excluded.action_required, awaiting maintainer approval via Approve and run; tests have not executed.Risks and limitations
The earlier profiling figures above come from the original combined change. This standalone PR has not been rebenchmarked, so they are not a verified speedup for its current head. Recovery after a missed configuration update and behavior with multiple FinderSync instances still need validation in the signed app.
The regular local Xcode test host exited before executing tests. The temporary SwiftPM library host compiles the same production sources, excluding the app entry point; its results do not replace end-to-end testing of the signed app.
Related PRs
Split from #166 at the maintainer's suggestion:
Each PR targets
devand builds independently. Combining them in the order above was verified to merge without conflicts.