build: generate Electron-specific PGO profiles in CI#51826
Merged
MarshallOfSound merged 1 commit intoJun 1, 2026
Conversation
Adds a workflow_dispatch pipeline that builds PGO-instrumented Electron for every published platform/arch combo, collects optimization profiles by running benchmark and app-style workloads against each build, and publishes merged profiles to https://dev-cdn.electronjs.org/pgo/. Why: Electron release builds apply Chrome's published PGO profile, which matches functions by symbol name and control-flow hash. Every function that differs from Chrome - all of Node.js, patched Chromium code, V8 built with Node's flags, and the shell/ code - silently gets no optimization guidance and is laid out as cold. The same applies to V8's builtins profile: Chrome's published profiles reject Electron's promise/async builtins because the Node integration changes their codegen. Measured on Linux x64, an Electron-collected profile is worth +9.5% on Speedometer 3.1 and +16% geomean across 22 app-operation benchmarks (contextBridge calls +44-51%) versus Chrome's profile. The pipeline: - Instrumented builds (chrome_pgo_phase = 1) for linux x64/arm/arm64, win x64/x86/arm64, and macos x64/arm64, each collecting on hosts that can run its own binaries. - Collection workloads: Speedometer 3 (x3), JetStream 2, and MotionMark (the same set Chromium's PGO recipe uses), plus Electron-specific phases browser benchmarks cannot cover: main-process Node.js (Buffer/crypto/fs/JSON), contextBridge and ipcRenderer.invoke marshaling, and renderer/Node networking over HTTPS + HTTP/2 with real certificate verification via an ephemeral CA installed in the collection host's trust store. - A V8 builtins profile generated from an instrumented d8 built with Electron's exact V8 configuration; one x64 profile covers x64 and arm64 (builtin block graphs are arch-independent, mirroring upstream). - Per-platform profraw sets merged with in-tree llvm-profdata tooling, then uploaded via OIDC through the pgo-upload GitHub environment (manual approval, no long-lived credentials). Build-system changes: - build/args/pgo-instrument.gn and pgo-builtins-instrument.gn instrumented build configurations (symbol_level = 0, no dSYMs - instrumented binaries are never shipped and do not fit on macOS runners with debug info). - A Chromium patch fixing profile-runtime resolution for instrumented builds on Linux arm32 (clang package ships the armv7 triple; the driver resolves the arm triple) and Windows cross-compiles (objects embed the per-target runtime lib name; the Windows package ships the legacy layout). Chrome never builds these configurations; the patch is upstreamable. - generate-chromedriver and generate-test-artifacts flags on the build segment and build-electron action (default true, no behavior change for existing callers) so instrumented builds skip artifacts only consumed by test jobs. Release builds do not consume these profiles yet; that is a follow-up change. Co-authored-by: Sam Attard <sattard@anthropic.com>
5 tasks
MarshallOfSound
approved these changes
Jun 1, 2026
|
No Release Notes |
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.
Backport of #51812
See that PR for details.
Notes: none