Skip to content

build: generate Electron-specific PGO profiles in CI#51826

Merged
MarshallOfSound merged 1 commit into
42-x-yfrom
trop/42-x-y-bp-build-generate-electron-specific-pgo-profiles-in-ci-1780342453293
Jun 1, 2026
Merged

build: generate Electron-specific PGO profiles in CI#51826
MarshallOfSound merged 1 commit into
42-x-yfrom
trop/42-x-y-bp-build-generate-electron-specific-pgo-profiles-in-ci-1780342453293

Conversation

@trop

@trop trop Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Backport of #51812

See that PR for details.

Notes: none

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>
@trop trop Bot requested a review from a team as a code owner June 1, 2026 19:34
@trop trop Bot requested a review from MarshallOfSound June 1, 2026 19:34
@trop trop Bot added 42-x-y backport This is a backport PR semver/none labels Jun 1, 2026
@MarshallOfSound MarshallOfSound merged commit 02044ed into 42-x-y Jun 1, 2026
45 checks passed
@release-clerk

release-clerk Bot commented Jun 1, 2026

Copy link
Copy Markdown

No Release Notes

@MarshallOfSound MarshallOfSound deleted the trop/42-x-y-bp-build-generate-electron-specific-pgo-profiles-in-ci-1780342453293 branch June 1, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant