GPU benchmark: isolate trials, time the card, say which map drew

- A trial now ends before the next starts: the clock stops, the frame
  callback is cancelled (and a queued one turned away), a day still in the
  route worker is waited for (or dropped), the clock's leftovers are cleared,
  and every trial starts from the same random numbers.
- The renderers take turns going first, scenario by scenario; ?reps=N runs
  each N times and reports medians.
- draw() is labelled as CPU submission time; the card's own time comes from
  EXT_disjoint_timer_query_webgl2 where available (read frames later, never
  waited for, disjoint results dropped); a run drawn by the other map is
  flagged.
- npm run perf --browser reads its sync pixel back from the surface the map
  was drawn on (the WebGL canvas waits for the card) and says which map each
  version drew with.
This commit is contained in:
Antoine 2026-11-04 14:09:22 +01:00
parent 8491b1a8f6
commit 1e9b1d458b
No known key found for this signature in database
GPG key ID: 728FF1CE15732B05
4 changed files with 181 additions and 33 deletions

View file

@ -98,7 +98,10 @@ md += `### Headless (jsdom)\n\nOur JavaScript only: jsdom has no layout and its
const slow = base ? slowIn(res, 2) : [];
const { PROFILES } = browser ? require('./perf-browser') : { PROFILES: [] };
for (const p of PROFILES) {
md += `\n### Chromium ${browser.version}: ${p.key === 'phone' ? 'phone' : 'desktop'}\n\n${p.key === 'phone' ? 'A 390×844 screen at 3× pixel density, with the CPU slowed down 4× like a mid-range Android.' : 'A 1280×800 window at full speed.'} Real DOM, layout and canvas.\n\n` + table(browser.profiles[p.key], 2 * p.rate);
// The map row is the whole frame, up to a pixel read back from the surface that drew it; say which one that was.
const mp = browser.profiles[p.key].maps, mapName = (m) => (!m || !m.length ? 'no map' : m.map((x) => (x === 'gl' ? 'WebGL' : '2D canvas')).join(' then '));
const drew = mp ? ` The map was drawn with ${base ? `${mapName(mp.base)} (base) and ${mapName(mp.head)} (this PR)` : mapName(mp.head)}; its row waits for that surface to finish.` : '';
md += `\n### Chromium ${browser.version}: ${p.key === 'phone' ? 'phone' : 'desktop'}\n\n${p.key === 'phone' ? 'A 390×844 screen at 3× pixel density, with the CPU slowed down 4× like a mid-range Android.' : 'A 1280×800 window at full speed.'} Real DOM, layout and canvas.${drew}\n\n` + table(browser.profiles[p.key], 2 * p.rate);
if (base) slow.push(...slowIn(browser.profiles[p.key], 2 * p.rate).map((l) => `${l} (Chromium ${p.key})`));
}
if (base) {