Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@
# `dist/bench/`.
name: bench

# A push to main runs the default matrix (producers x receivers x ops,
# direct transport, 15 samples: ~10 minutes). `workflow_dispatch` with
# `full: true` adds the chunked transport and 25 samples (~45 minutes).
on:
push:
branches: [main]
workflow_dispatch:
inputs:
full:
description: "Full matrix (chunked transport too) with 25 samples"
type: boolean
default: false

concurrency:
group: bench-${{ github.ref }}
Expand Down Expand Up @@ -47,7 +55,7 @@ jobs:
node-version: "24"
- run: just components
- run: just site
- run: deno run -A bench/run.ts --sample-size 25
- run: deno run -A bench/run.ts ${{ inputs.full && '--full --sample-size 25' || '--sample-size 15' }}
- uses: benchmark-action/github-action-benchmark@v1
with:
tool: customSmallerIsBetter
Expand Down
7 changes: 6 additions & 1 deletion bench/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
// (dispatch: "bench" track).
//
// deno run -A bench/run.ts [--sample-size N] [--filter substring]
// [--chrome-binary path]
// [--chrome-binary path] [--full]
//
// `--full` adds the `chunked` transport (see tachometer.ts's GenerateOptions).
//
// Requires `just site` first (this does not build `dist/` itself, unlike
// `just bench`, which runs `site` before this).
Expand All @@ -20,6 +22,7 @@ interface Args {
sampleSize?: number;
filter?: string;
chromeBinary?: string;
full?: boolean;
}

function parseArgs(argv: string[]): Args {
Expand All @@ -30,6 +33,7 @@ function parseArgs(argv: string[]): Args {
if (a === "--sample-size") args.sampleSize = Number(rest.shift());
else if (a === "--filter") args.filter = rest.shift();
else if (a === "--chrome-binary") args.chromeBinary = rest.shift();
else if (a === "--full") args.full = true;
else {
console.error(`unknown argument: ${a}`);
Deno.exit(2);
Expand All @@ -54,6 +58,7 @@ const config = generateConfig({
filter: args.filter,
sampleSize: args.sampleSize,
chromeBinary: args.chromeBinary,
full: args.full,
});
const configPath = join(benchDir, "tachometer.json");
await Deno.writeTextFile(configPath, JSON.stringify(config, null, 2) + "\n");
Expand Down
6 changes: 6 additions & 0 deletions bench/tachometer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,19 @@ export interface GenerateOptions {
sampleSize?: number;
/** `browser.binary` passthrough — a local Chrome/Chromium binary path. */
chromeBinary?: string;
/** Include the `chunked` transport. Off by default: it is a diagnostic
* knob, not a shipped path, and it doubles a run that is dominated by
* per-sample page loads (the full 72-variant matrix at 25 samples took
* 45 minutes on a GitHub runner). */
full?: boolean;
}

export function generateConfig(opts: GenerateOptions): TachometerConfig {
const benchmarks: TachometerBenchmark[] = [];
for (const producer of PRODUCERS) {
for (const receiver of RECEIVERS) {
for (const transport of TRANSPORTS) {
if (transport === "chunked" && !opts.full) continue;
for (const op of OPS) {
const name = `${producer}/${receiver}/${transport}/${op}`;
if (opts.filter && !name.includes(opts.filter)) continue;
Expand Down
Loading