test(tests): R4.9 memory bench: linear memory, renderer RSS, live canvases/images/blobs/object URLs, transient peaks and rest windows per export, three engines; raster-only control and Chromium pressure step; first run results

This commit is contained in:
bchanot committed 2026-10-20 21:03:56 +02:00
1 parent 6166eba5f1
commit ecc8699074
4 files changed
+4997 -6

No files matched your search

+12 -6
View File
@@ -16,6 +16,7 @@
import { readFileSync, mkdirSync, writeFileSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { parseArgs } from 'node:util'
import { pathToFileURL } from 'node:url'
import { checkBuild } from './lib/app-build.mjs'
import { delay, firstLine, tagged, timeoutAfter } from './lib/async.mjs'
import { hostFacts } from './lib/host.mjs'
@@ -40,13 +41,13 @@ import { deltasOf } from './r4-leak-series.mjs'
import { startServer } from './serve.mjs'
const MINUTE = 60_000
const EXPORT_LABEL = 'Exporter en PDF' // fr.ts editor.export
export const EXPORT_LABEL = 'Exporter en PDF' // fr.ts editor.export
const CANVAS = '.svg-canvas [data-anno-id]'
const LOAD_TIMEOUT_MS = 2 * MINUTE
const BETWEEN_MS = 2000
const FINAL_IDLE_MS = 5000
const TEN_MIB = 10 * 1024 * 1024
const REPORTS = {
export const REPORTS = {
demo: { file: 'report-v3.demo.json', timeoutMs: 5 * MINUTE },
L: { file: 'r4/reports/L.json', timeoutMs: 30 * MINUTE },
}
@@ -91,12 +92,14 @@ function draftOf(name) {
return JSON.stringify(JSON.parse(text))
}
async function openEditor(session, baseUrl, name) {
/** One editor tab seeded with `name`; `init` = extra init scripts (the memory bench). */
export async function openEditor(session, baseUrl, name, init = []) {
const context = await session.browser.newContext({
acceptDownloads: true,
locale: 'fr-FR',
})
const seed = { draft: draftOf(name), locale: 'fr', skipDisclaimer: true }
for (const script of init) await context.addInitScript(script)
const { page, events } = await probedPage(context, seed)
const cdp =
session.engine === 'chromium' ? await context.newCDPSession(page) : null
@@ -113,12 +116,15 @@ async function reading(session, tab) {
}
/** One export: click, the download, the button enabled again; its timing entry. */
async function exportOnce(tab, timeoutMs) {
export async function exportOnce(tab, timeoutMs) {
const download = tab.page.waitForEvent('download', { timeout: 0 })
download.catch(() => undefined)
const started = performance.now()
const end = await Promise.race([
tagged('downloaded', tab.button.click().then(() => download)),
tagged(
'downloaded',
tab.button.click().then(() => download),
),
timeoutAfter(timeoutMs),
])
if (end.kind !== 'downloaded') {
@@ -270,4 +276,4 @@ async function main() {
console.log(table(runs))
}
await main()
if (import.meta.url === pathToFileURL(process.argv[1]).href) await main()