Repository navigation
docs: note Linux performance characteristics of getApplicationNameForProtocol - #51099
officialasishkumar wants to merge 1 commit into
Conversation
|
For more information on signing commits, see GitHub's documentation on Telling Git about your signing key. |
4ed3b0f to
27272fc
Compare
ckerr
left a comment
There was a problem hiding this comment.
Needs to be rebased on main to fix this linting issue:
2026-04-16T18:38:00.3987755Z Checking formatting...
2026-04-16T18:38:00.3988044Z
2026-04-16T18:38:00.5144584Z spec/fixtures/crash-cases/webview-destroy-in-event/index.js (0ms)
2026-04-16T18:38:00.5145150Z
2026-04-16T18:38:00.5145562Z Format issues found in above 1 files. Run without `--check` to fix.|
Hmm I wonder if we could just make this faster by using I'll poke around on this and see. |
…Protocol The Linux implementation of Browser::GetApplicationNameForProtocol() invokes `xdg-mime query default` via base::GetAppOutputWithExitCode, which spawns a subprocess and blocks on its exit. macOS (via LSCopyDefaultApplicationURLForURL) and Windows (via AssocQueryString) both resolve the default handler in-process through system APIs, so the Linux path is orders of magnitude slower and is easy to overlook when a build profile runs on those platforms. Add a note to the API documentation describing this difference and recommending that callers on hot paths cache the result, so developers can avoid repeated slow invocations on Linux without needing to read the browser_linux.cc implementation. Refs: electron#49727 Signed-off-by: Asish Kumar <[email protected]>
27272fc to
72940d3
Compare
|
Rebased onto |
|
Superseded by #51251 -- we no longer spawn a process for this 😄 |
Description of Change
The Linux implementation of
Browser::GetApplicationNameForProtocol()invokesxdg-mime query defaultviabase::GetAppOutputWithExitCode, which spawns a subprocess and blocks on its exit. macOS (viaLSCopyDefaultApplicationURLForURLinbrowser_mac.mm) and Windows (viaAssocQueryStringinbrowser_win.cc) both resolve the default handler in-process through system APIs, so the Linux path is orders of magnitude slower.This performance gap is easy to miss when development and testing happen primarily on macOS or Windows, and it can bite apps that call the API on a hot path (for example, when determining the handler for every outbound link).
This PR adds a note to the API documentation describing the difference and recommending that callers on hot paths cache the result, so app developers can avoid repeated slow invocations on Linux without needing to read the platform-specific implementations.
Refs #49727
Checklist
Release Notes
Notes: none