Unclaimed files left in the canonical checkout. Inventory: canonical-cleanup-inventory.md (commit-as-evidence groups). detect-secrets scan clean on 2026-11-02: hits are sha256 pins, git object ids, test sentinels already in tracked tests and unit-file lines.
17 lines
1.1 KiB
JavaScript
17 lines
1.1 KiB
JavaScript
// Times one render() of one line: marker + run of n chars + tail. Args: shape variant kib.
|
||
import { readFileSync } from 'node:fs';
|
||
import { runInNewContext } from 'node:vm';
|
||
const [shape, variant, kib] = process.argv.slice(2);
|
||
const src = readFileSync(process.env.MDP, 'utf8');
|
||
const window = {}; runInNewContext(src, { window });
|
||
class N { constructor(t) { this.c = []; } appendChild(x) { this.c.push(x); return x; } setAttribute() {} set textContent(v) {} get lastChild() { return this.c.at(-1); } }
|
||
const doc = { createElement: t => new N(t), createTextNode: t => ({ t }), createDocumentFragment: () => new N('#f') };
|
||
const n = Number(kib) * 1024;
|
||
const tail = { u2028: '
', u2029: '
', letter: 'x' }[variant];
|
||
const line = { ITEM: '-' + ' '.repeat(n), ATX: '#' + ' '.repeat(n), FENCE: '`'.repeat(n) }[shape] + tail;
|
||
const meter = {};
|
||
const t0 = performance.now();
|
||
window.MosaicMarkdown.render(line, doc, meter);
|
||
const ms = performance.now() - t0;
|
||
console.log(`${shape} ${variant} ${kib}KiB len=${line.length} ms=${ms.toFixed(1)} work=${meter.work} budget=${meter.budget}`);
|