Files
bchanot c84186b032 test(tests): R4.2e browser measurements of the Rust import (module worker page, same perimeter as the TS baseline)
r4-import.mjs runs the 226 baseline files and the hostile classes through a disposable
module worker calling SheetHandle.import_pdf in Chromium 156, Firefox 157 and WebKit 27.2
under the RSS watchdog (not a guaranteed limit); compare-imports.mjs prints TS vs Rust;
serve.mjs gains opt-in mounts (/r4/, /pkg/). Results 2026-10-18-r4-import.json: 666/678
agreements, the 12 others are the 4 declared files; W4 met (max 68 MiB linear); the
1 GiB ceiling traps in every engine.
2026-10-18 16:58:42 +02:00

22 lines
661 B
JavaScript

/**
* A results file as text: indented, except that each run of a `runs`
* array sits on one line, so a full R4 run (about 700 runs) stays under
* 1 MB and still diffs run by run.
*/
export function resultsJson(result) {
const runLists = []
const text = JSON.stringify(
result,
(key, value) => {
if (key !== 'runs' || !Array.isArray(value)) return value
runLists.push(value.map((run) => JSON.stringify(run)))
return `@@runs:${runLists.length - 1}@@`
},
1,
)
return text.replace(/"@@runs:(\d+)@@"/g, (_, i) => {
const runs = runLists[Number(i)]
return runs.length ? `[\n${runs.join(',\n')}\n]` : '[]'
})
}