MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / growth

Function growth

scripts/regression/gate.mjs:339–363  ·  view source on GitHub ↗

Each generated case's seconds at each size, from the two benchmark harnesses.

()

Source from the content-addressed store, hash-verified

337
338/** Each generated case's seconds at each size, from the two benchmark harnesses. */
339async function growth() {
340 const large = join(repo, 'scripts', 'benchmarks', 'large-files');
341 const seconds = {};
342 const harnesses = [
343 ['kernel-languages.mjs', ['', `${KERNEL_SHAPES},minified`], (out) => [...out.matchAll(/^(\S+)\s+(\S+)\s+([\d.]+) s\s+\d+ symbols/gm)].map(([, language, shape, took]) => [`${language}/${shape}`, Number(took)])],
344 ['other-languages.mjs', [], (out) => [...out.matchAll(/^(\S+)\s+([\d.]+) s\s+[\d.]+ MB/gm)].map(([, name, took]) => [name, Number(took)])],
345 ];
346 for (const [name, extra, read] of harnesses) {
347 const script = join(large, name);
348 const listed = run(node, [script, dist, GROWTH_SIZES[0], ...extra], { env: { BENCH_LIST: '1' } });
349 if (listed.status !== 0) throw new Error(`${name} could not list its cases:\n${listed.stderr}`);
350 const cases = listed.stdout.split('\n').filter(Boolean);
351 for (const size of GROWTH_SIZES) {
352 // What is left after a case that hung is run again, so one hang hides nothing after it.
353 for (let left = cases; left.length > 0; ) {
354 const { finished, hung } = await watched(script, size, extra, left, read);
355 for (const [each, took] of finished) (seconds[each] ??= {})[size] = took;
356 if (hung === null) break;
357 fail('GROWTH', hung, `printed nothing for ${CASE_LIMIT_SECONDS} s at ${size} MB and was stopped`);
358 left = left.slice(left.indexOf(hung) + 1);
359 }
360 }
361 }
362 return seconds;
363}
364
365// ---------------------------------------------------------------------------------------------
366// The run

Callers 1

gate.mjsFile · 0.85

Calls 6

NumberInterface · 0.85
watchedFunction · 0.85
mapMethod · 0.80
runFunction · 0.70
failFunction · 0.70
joinFunction · 0.50

Tested by

no test coverage detected