perf(menubar): cache native images - #547
Closed
JustYannicc wants to merge 1 commit into
Closed
Conversation
Collaborator
Author
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.
What Changed
iconBitmapScale, template-image behavior, emoji title fallback, and menu item click routing.Why
Extensions with ticking menu-bar titles or item labels can still send accepted updates where icon sources are unchanged. Previously the main process rebuilt NativeImage objects and resized icons on every accepted payload, which could add visible menu-bar lag.
The new focused metric covers 20 repeated accepted updates with 1 tray icon and 36 item/submenu icons: native decode/read/resize operations drop from 1620 before caching to 81 after caching.
Compatibility Impact
Behavior should stay compatible with current MenuBarExtra rendering. Path icons refresh when file size or mtime changes, SVG fallbacks are still used when native path decoding returns empty, template images are cached separately from non-template images, and the cache is bounded and cleared on quit.
How Tested
node --no-warnings --test scripts/test-menubar-native-image-cache.mjspnpm run build:mainsrc/main/menubar-native-image-cache.tssrc/main/main.tsStack Validation
Clean PR branch
codex/perf-menubar-native-image-cache-prwas created fromorigin/mainand contains only the menubar native image cache fix.