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.
20 lines
819 B
JavaScript
20 lines
819 B
JavaScript
// Row 148 round 3: a no-module control for the probe. Same input size as a probe cell, no parser:
|
|
// line split, one regex replace per line, character concatenation. Prints "<KiB> KiB <ms> ms".
|
|
// If this fails a ratio rule, the rule is measuring the machine, not the module.
|
|
// Usage: node ctl-concat.mjs <KiB>
|
|
const k = Number(process.argv[2]);
|
|
const n = k * 1024;
|
|
const line = '-' + 'abcdefghij'.repeat(Math.ceil(n / 10)).slice(0, n - 1);
|
|
const t = [];
|
|
for (let r = 0; r < 5; r++) {
|
|
const t0 = performance.now();
|
|
const lines = line.replace(/\r\n?/g, '\n').split('\n').map(l => l.replace(/^[ \t]+/, w => w));
|
|
let p = '';
|
|
const s = lines[0];
|
|
for (let i = 0; i < s.length; i++) p += s[i];
|
|
p.length;
|
|
t.push(performance.now() - t0);
|
|
}
|
|
t.sort((a, b) => a - b);
|
|
console.log(k, 'KiB', t[2].toFixed(1), 'ms');
|