Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bin/benchmark/run.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ async function bootAndRun({ headless = true } = {}) {
// as the contradictory flags cause use-after-free crashes on macOS
'--disable-gpu',
'--disable-gpu-compositing',
// Exposes gc(), which the benchmark app calls between phases (see
// waitForIdle in smoke-tests/benchmark-app/app/run-benchmark.js), so
// the garbage of one phase is not collected inside a later one.
'--js-flags=--expose-gc',
].join(','),
];

Expand Down
11 changes: 10 additions & 1 deletion smoke-tests/benchmark-app/app/run-benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@ export function emitDomClickEvent(selector) {

export function waitForIdle() {
return new Promise((resolve) => {
requestIdleCallback(resolve);
requestIdleCallback(() => {
// Collect the previous phase's garbage outside of any measured phase.
// Chrome only exposes gc() with --js-flags=--expose-gc.
if (typeof globalThis.gc === 'function') {
globalThis.gc();
requestIdleCallback(resolve);
} else {
resolve();
}
});
});
}

Expand Down
Loading