GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — opencode/packages/opencode/script/bench-test-suite.ts at dev · sujee/opencode Expand file tree/ Copy pathbench-test-suite.tsMore file actions 52 lines (45 loc) · 1.93 KB / Copy pathbench-test-suite.tsFile metadata and controls52 lines (45 loc) · 1.93 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 // Full-suite timing harness for the test-speed research in ../../perf/test-suite.md. // Use this for periodic sanity checks; use profile-test-files.ts for discovery. // Env: BENCH_WARMUPS=0 BENCH_RUNS=1 bun run bench:test const warmups = Number(Bun.env.BENCH_WARMUPS ?? 0) const runs = Number(Bun.env.BENCH_RUNS ?? 1) const timings: number[] = [] if (!Number.isInteger(warmups) || warmups < 0) { console.error("BENCH_WARMUPS must be a non-negative integer") process.exit(1) } if (!Number.isInteger(runs) || runs < 1) { console.error("BENCH_RUNS must be a positive integer") process.exit(1) } for (const index of Array.from({ length: warmups + runs }, (_, index) => index)) { const measured = index >= warmups const label = measured ? `run ${index - warmups + 1}/${runs}` : `warmup ${index + 1}/${warmups}` const start = performance.now() console.log(`bench:test ${label}`) const proc = Bun.spawn(["bun", "test", "--timeout", "30000"], { cwd: import.meta.dir + "/..", stdout: "inherit", stderr: "inherit", env: Bun.env, }) const exitCode = await proc.exited if (exitCode !== 0) { console.error(`bench:test failed during ${label} with exit code ${exitCode}`) process.exit(exitCode) } const seconds = (performance.now() - start) / 1000 console.log(`bench:test ${label} ${seconds.toFixed(3)}s`) if (measured) timings.push(seconds) } const sorted = timings.toSorted((a, b) => a - b) const median = sorted[Math.floor(sorted.length / 2)] const mean = timings.reduce((sum, timing) => sum + timing, 0) / timings.length const best = sorted[0] ?? median const worst = sorted.at(-1) ?? median console.log( `bench:test median=${median.toFixed(3)}s mean=${mean.toFixed(3)}s best=${best.toFixed(3)}s worst=${worst.toFixed(3)}s`, ) console.log(`METRIC test_suite_seconds=${median.toFixed(3)}`) console.log(`METRIC test_suite_best_seconds=${best.toFixed(3)}`) console.log(`METRIC test_suite_worst_seconds=${worst.toFixed(3)}`) |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |