✨ Select the GPU harness edit shape by id

This commit is contained in:
Elena Torro 2026-09-29 12:28:10 +02:00
parent 71cae946ab
commit be3fdb6f13
2 changed files with 15 additions and 1 deletions

View File

@ -32,6 +32,7 @@ Projects: `gpu-memory-chromium`, `gpu-memory-firefox`, `gpu-memory-webkit`.
| `PERF_ITERATIONS` | `12` | Steps per phase |
| `PERF_DPR` | `2` | Device pixel ratio |
| `PERF_EDIT_TARGET` | select all | `x,y` in CSS px: the edit phase selects the element there instead of everything |
| `PERF_EDIT_SHAPE` | off | Shape id to select for the edit phase; wins over `PERF_EDIT_TARGET` and doesn't depend on the view |
| `PERF_SKIA_CACHE_MB` | build default | Skia resource cache budget, set after the first render (needs `set_resource_cache_limit_mb` in the wasm build) |
| `PERF_PURGE_PROBE` | off | `1` calls `free_gpu_resources` at the end and samples again |
| `PERF_TIMEOUT_MIN` | `15` | Time limit per run; heavy fixtures in Firefox need more |

View File

@ -28,6 +28,9 @@ const config = {
// "x,y" in CSS px: select the element there instead of everything. On a
// big page, moving every shape at once takes minutes per step.
editTarget: env.PERF_EDIT_TARGET?.split(",").map(Number) ?? null,
// Shape id to select for the edit phase. Unlike PERF_EDIT_TARGET it does
// not depend on where zoom and pan left the view.
editShape: env.PERF_EDIT_SHAPE ?? null,
skiaCacheMb: env.PERF_SKIA_CACHE_MB ? Number(env.PERF_SKIA_CACHE_MB) : null,
timeoutMin: Number(env.PERF_TIMEOUT_MIN ?? 15),
outDir: env.PERF_OUT_DIR ?? "playwright/perf/results",
@ -211,7 +214,16 @@ for (let repeat = 0; repeat < config.repeats; repeat++) {
await sample("pan", i);
}
if (config.editTarget) {
if (config.editShape) {
await page.evaluate((id) => {
const { app } = globalThis;
app.main.store.emit_BANG_(
app.main.data.workspace.selection.select_shape(
app.common.uuid.uuid(id),
),
);
}, config.editShape);
} else if (config.editTarget) {
const [ex, ey] = config.editTarget;
await page.mouse.click(ex, ey);
} else {
@ -250,6 +262,7 @@ for (let repeat = 0; repeat < config.repeats; repeat++) {
iterations: config.iterations,
skiaCacheMb: config.skiaCacheMb,
editTarget: config.editTarget,
editShape: config.editShape,
viewport: base,
dpr: testInfo.project.use.deviceScaleFactor ?? 1,
renderer,