Skip to content
Open
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
119 changes: 119 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: benchmark

# Measures the base and head revisions back to back in one job, so both sides share the same
# runner. GitHub-hosted runners are shared VMs: read the base → head comparison, not the absolute
# numbers, and keep publishing README figures from a quiet local machine.

on:
pull_request:
paths:
- package.json
- pnpm-lock.yaml
- pnpm-workspace.yaml
- tools/**
- scripts/**
- src/**
- tsconfig*.json
- .github/workflows/benchmark.yml
workflow_dispatch:
inputs:
base-ref:
description: Revision to compare against
default: main
runs:
description: Fresh-process runs per checker (timing and checker scaling)
default: "5"
memory-runs:
description: Fresh-process runs per checker (peak memory)
default: "3"

permissions:
contents: read

concurrency:
group: benchmark-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
compare:
runs-on: macos-15
timeout-minutes: 120
env:
RUNS: ${{ inputs.runs || '5' }}
MEMORY_RUNS: ${{ inputs.memory-runs || '3' }}
steps:
- uses: actions/checkout@v7
with:
path: head
- uses: actions/checkout@v7
with:
path: base
ref: ${{ github.event.pull_request.base.sha || inputs.base-ref }}
- uses: voidzero-dev/setup-vp@v1.21.2
with:
version: 1.3.0
node-version: 26
cache: false
run-install: false
- name: Install base
working-directory: base
run: vp install
- name: Install head
working-directory: head
run: vp install
- name: Record versions
run: |
for side in base head; do
echo "$side: $(cd "$side" && node_modules/.bin/vize --version), $(cd "$side" && node_modules/.bin/tsrs --version)"
done
sysctl -n machdep.cpu.brand_string hw.ncpu hw.memsize vm.loadavg

# Alternate base and head per benchmark, so slow drift on the runner hits both sides.
- name: Timing (base)
working-directory: base
run: vp run --no-cache benchmark --runs "$RUNS"
- name: Timing (head)
working-directory: head
run: vp run --no-cache benchmark --runs "$RUNS"
- name: vize check scaling (base)
working-directory: base
run: vp run --no-cache benchmark:vize-checkers --runs "$RUNS"
- name: vize check scaling (head)
working-directory: head
run: vp run --no-cache benchmark:vize-checkers --runs "$RUNS"
- name: Peak memory (base)
working-directory: base
run: vp run --no-cache benchmark:memory --runs "$MEMORY_RUNS"
- name: Peak memory (head)
working-directory: head
run: vp run --no-cache benchmark:memory --runs "$MEMORY_RUNS"

# Only reports produced by this job: a failed step must not fall back to committed results.
- name: Collect new reports
if: ${{ !cancelled() }}
run: |
mkdir -p reports/base reports/head
for side in base head; do
(cd "$side" && git ls-files --others --exclude-standard benchmark/results) |
while read -r report; do cp "$side/$report" "reports/$side/"; done
done
- name: Summarize
if: ${{ !cancelled() }}
run: |
node head/scripts/compare-results.mjs --base reports/base --head reports/head \
>> "$GITHUB_STEP_SUMMARY"
{
echo
echo "<details><summary>Head reports</summary>"
echo
for report in reports/head/*.md; do
sed 's/^# /### /' "$report"
echo
done
echo "</details>"
} >> "$GITHUB_STEP_SUMMARY"
- uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: benchmark-results
path: reports
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,23 @@ vp run check:vize-cli
It is intentionally excluded from the five-way Content Mapper table so that unlike pipelines are
not presented as interchangeable.

### CI comparison

The [`benchmark`](./.github/workflows/benchmark.yml) workflow runs on pull requests that touch
dependencies, scripts, the corpus, or tsconfig files, and on demand through `workflow_dispatch`
(`base-ref`, `runs`, and `memory-runs` inputs). It checks out the base and head revisions into one
`macos-15` job, alternates base and head for timing, `vize check` scaling, and peak memory, and
writes a base → head table to the job summary. The new reports are uploaded as the
`benchmark-results` artifact.

GitHub-hosted runners are shared VMs with fewer cores than the recorded machine, so use the CI run
to see whether a version bump moves each lane, not as the published figures. Compare two result
directories locally with:

```sh
vp run compare --base <base-results-dir> --head <head-results-dir>
```

## Recorded result

Apple M5 Pro, 48 GiB RAM, Node.js 26.13.0, `vize@0.746.0`, `@vue/content-mapper@4.0.0-alpha.3`,
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@
"verify": "node scripts/verify-diagnostics.mjs",
"benchmark": "node scripts/benchmark.mjs",
"benchmark:vize-checkers": "node scripts/benchmark-vize-checkers.mjs",
"benchmark:memory": "node scripts/benchmark-memory.mjs"
"benchmark:memory": "node scripts/benchmark-memory.mjs",
"compare": "node scripts/compare-results.mjs"
},
"devDependencies": {
"@vue/content-mapper": "4.0.0-alpha.3",
"tsrs": "0.25.0-ts7.1.0-beta",
"tsrs": "7.1.0-beta.tsrs7",
"typescript": "7.1.0-beta",
"vize": "0.746.0",
"vize": "0.826.0",
"vite-plus": "1.3.0",
"vue": "3.5.44"
}
Expand Down
Loading
Loading