jkleinsc

#55638: build: fix the benchmark resize metric matching the next resize's frame

Merged
Created: Nov 5, 2026, 6:28:02 PM
Merged: Nov 8, 2026, 11:04:00 PM
1 comments
Target: main

Requested by John Kleinschmidt · Slack thread

Description of Change

The nightly benchmark's resize metric was measuring the wrong frame. In scheduled run 42106627126 it reported a median of 150.67 ms and a p90 of 151.5 ms on both nightlies. That is about one resize step (100 ms idle, two frames and the IPC) plus one frame, not the cost of the resize.

The trace query matched the first renderer PipelineReporter that began after Widget::OnNativeWidgetSizeChanged. A PipelineReporter starts at its BeginFrame timestamp. That timestamp is often 1–2 ms before the resize, even when the frame's main frame applies the resize, because the 100 ms step is six vsync intervals and so keeps the same phase every time. The query skipped that frame. When the main frame finished within one vsync, the next frame had nothing to draw (STATE_NO_UPDATE_DESIRED), so the match fell through to the next resize's frame. On a fast runner that happens on almost every resize.

The page now records a cb-resized mark from its resize event. The query now matches the first presented renderer frame whose main frame committed (the end of SendBeginMainFrameToCommit) after that mark, and before the next resize. The README and the page comment describe the new matching.

Local reproduction with 47.0.0-nightly.20261105, the trace suite under Xvfb on a 4-vCPU VM, comparing the old and new queries on the same traces:

  • Old query: values of 150.8–163.7 ms showed up in every repetition (up to 7 of 20 in one), and each one fell on a resize whose real frame presented about 17 ms after it.
  • New query: 16.2–53.5 ms across 3×20 resizes, and nothing near 150 ms. On resizes the old query matched correctly, both queries give the same values.

Checklist

  • I have built and tested this change
  • I have filled out the PR description
  • node --test script/benchmarks/test/*.test.mts passes, along with tsc -p tsconfig.script.json, oxlint and oxfmt

Release Notes

Notes: none


Generated by Claude Code

Backports

No Backports Requested

This pull request doesn't have any backports requested or created for older release branches.

What are backports?

Backports are copies of changes made to the main branch that are applied to older release branches. They ensure that bug fixes and important changes are available in maintained older versions of Electron.

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron