[READ-ONLY] Mirror of https://github.com/bombshell-dev/tty. Platform independent 2D layout engine for terminal applications based on Clay
5

Configure Feed

Select the types of activity you want to include in your feed.

ref(bench): spawn fixture

Nate Moore (May 31, 2026, 11:28 PM -0500) baa61932 8777e165

+69 -38
+36 -4
.github/workflows/benchmark.yml
··· 50 50 with: 51 51 mode: simulation 52 52 # IMPORTANT! deno task bench fails in CI due to incompatible V8 bindings 53 - run: | 54 - node bench/mod.ts 55 - node bench/startup/createTerm.bench.ts 56 - node bench/startup/ttfr.bench.ts 53 + run: node bench/mod.ts 54 + 55 + startup-process-benchmarks: 56 + name: Run process startup benchmarks 57 + runs-on: codspeed-macro 58 + permissions: 59 + contents: read 60 + id-token: write 61 + 62 + steps: 63 + - name: Checkout 64 + uses: actions/checkout@v4 65 + with: 66 + submodules: true 67 + 68 + - name: Setup Deno 69 + uses: denoland/setup-deno@v2 70 + with: 71 + deno-version: v2.x 72 + 73 + - name: Setup Node 74 + uses: actions/setup-node@v4 75 + with: 76 + node-version: 22 77 + 78 + - name: Build WASM 79 + run: make 80 + 81 + - name: Install dependencies 82 + run: deno install 83 + 84 + - name: Run process startup benchmarks 85 + uses: CodSpeedHQ/action@v4 86 + with: 87 + mode: walltime 88 + run: node bench/startup.bench.ts
+3
bench/fixtures/create-term/mod.ts
··· 1 + import { createTerm } from "../../../term.ts"; 2 + 3 + await createTerm({ width: 80, height: 24 });
+9
bench/fixtures/render-minimal/mod.ts
··· 1 + import { createTerm } from "../../../term.ts"; 2 + import { close, grow, open, text } from "../../../ops.ts"; 3 + 4 + let term = await createTerm({ width: 80, height: 24 }); 5 + term.render([ 6 + open("root", { layout: { width: grow(), height: grow(), direction: "ttb" } }), 7 + text("Hello, World!"), 8 + close(), 9 + ]);
+9
bench/fixtures/utils.ts
··· 1 + import { fileURLToPath } from "node:url"; 2 + import { spawnSync } from "node:child_process"; 3 + 4 + export const fixture = (name: string) => { 5 + return new URL(`./${name}/mod.ts`, import.meta.url); 6 + } 7 + 8 + export const spawnFixture = (name: string) => 9 + spawnSync(process.execPath, [...process.execArgv, fileURLToPath(fixture(name))], { stdio: "ignore" });
+12
bench/startup.bench.ts
··· 1 + import { Bench } from "tinybench"; 2 + import { withCodSpeed } from "@codspeed/tinybench-plugin"; 3 + import { spawnFixture } from './fixtures/utils.ts'; 4 + 5 + let bench = withCodSpeed(new Bench({ name: "startup" })); 6 + 7 + bench 8 + .add("createTerm", () => spawnFixture('create-term')) 9 + .add("time to first render", () => spawnFixture('render-minimal')); 10 + 11 + await bench.run(); 12 + console.table(bench.table());
-14
bench/startup/createTerm.bench.ts
··· 1 - import { Bench } from "tinybench"; 2 - import { withCodSpeed } from "@codspeed/tinybench-plugin"; 3 - import { createTerm } from "../../term.ts"; 4 - 5 - let bench = withCodSpeed(new Bench({ name: 'startup', })); 6 - 7 - bench 8 - .add("createTerm", async () => { 9 - await createTerm({ width: 80, height: 24 }); 10 - }); 11 - 12 - await bench.run(); 13 - console.table(bench.table()); 14 -
-20
bench/startup/ttfr.bench.ts
··· 1 - import { Bench } from "tinybench"; 2 - import { withCodSpeed } from "@codspeed/tinybench-plugin"; 3 - import { createTerm } from "../../term.ts"; 4 - import { close, grow, open, text } from "../../ops.ts"; 5 - 6 - let bench = withCodSpeed(new Bench({ name: 'startup' })); 7 - 8 - bench 9 - .add("time to first render", async () => { 10 - let term = await createTerm({ width: 80, height: 24 }); 11 - term.render([ 12 - open("root", { layout: { width: grow(), height: grow(), direction: "ttb" } }), 13 - text("Hello, World!"), 14 - close(), 15 - ]); 16 - }); 17 - 18 - await bench.run(); 19 - console.table(bench.table()); 20 -