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
185 changes: 146 additions & 39 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ on:
runs:
description: "The number of runs on each benchmark"
default: "5"
regions:
description: "Regions to run the registry-* variations from: keys of the REGISTRY_RUNNERS repository variable (see docs/METHODOLOGY.md#regions)"
default: '["na", "eu"]'
schedule:
# GitHub Actions cron uses UTC. 10:17 UTC ~= 2:17 AM Pacific (PST).
- cron: "17 10 * * *"
Expand All @@ -34,6 +37,9 @@ jobs:
outputs:
skip_benchmarks: ${{ steps.check.outputs.skip_benchmarks }}
partial_run: ${{ steps.partial.outputs.partial_run }}
pm_variations: ${{ steps.plan.outputs.pm_variations }}
registry_matrix: ${{ steps.plan.outputs.registry_matrix }}
registry_jobs: ${{ steps.plan.outputs.registry_jobs }}
steps:
- uses: actions/checkout@v6
with:
Expand Down Expand Up @@ -98,6 +104,7 @@ jobs:
IN_BINARIES: ${{ inputs.binaries || '' }}
IN_WARMUP: ${{ inputs.warmup || '' }}
IN_RUNS: ${{ inputs.runs || '' }}
IN_REGIONS: ${{ inputs.regions || '' }}
run: |
# A dispatch with any non-default input produces a partial/tuned data
# set: results stay in artifacts + logs but must not deploy to
Expand All @@ -109,24 +116,40 @@ jobs:
[[ "$IN_BINARIES" == '"npm,yarn,berry,zpm,pnpm,vlt,bun,deno,aube,upm,nx,turbo,vp,node"' ]] || partial=true
[[ "$IN_WARMUP" == "2" ]] || partial=true
[[ "$IN_RUNS" == "5" ]] || partial=true
[[ "$IN_REGIONS" == '["na", "eu"]' ]] || partial=true
fi
echo "partial_run=$partial" >> "$GITHUB_OUTPUT"
if [[ "$partial" == "true" ]]; then
echo "::notice::Partial run detected (non-default dispatch inputs) — gh-pages deploy will be skipped; results live in job logs and artifacts."
fi
- name: Plan package-manager and registry jobs
id: plan
# Registry variations measure the network, so they run once per region
# on a runner pinned there; everything else measures the client and
# runs once. REGISTRY_RUNNERS (a repository variable, JSON) says which
# runner each region uses; unset, only "na" runs, on the GitHub-hosted
# runner it always used. See suite/scripts/plan-jobs.js.
env:
BENCH_FIXTURES: ${{ (github.event_name == 'push' && github.ref != 'refs/heads/main') && '["next", "astro", "vue", "svelte"]' || (inputs.fixtures || '["next", "astro", "vue", "svelte", "large", "babylon"]') }}
BENCH_VARIATIONS: ${{ inputs.variations || '["clean", "node_modules", "cache", "cache+node_modules", "cache+lockfile", "cache+lockfile+node_modules", "ci", "ci+setup", "lockfile", "lockfile+node_modules", "registry-clean", "registry-lockfile", "add-singleton", "remove-singleton", "add-overlap", "remove-overlap"]' }}
BENCH_REGIONS: ${{ inputs.regions || '["na", "eu"]' }}
REGISTRY_RUNNERS: ${{ vars.REGISTRY_RUNNERS }}
RUN_ID: ${{ github.run_id }}
run: node suite/scripts/plan-jobs.js

benchmark:
name: "Run Benchmarks"
runs-on: ubuntu-24.04-arm
needs: [detect-changes]
if: needs.detect-changes.outputs.skip_benchmarks != 'true'
if: needs.detect-changes.outputs.skip_benchmarks != 'true' && needs.detect-changes.outputs.pm_variations != '[]'
timeout-minutes: 120
environment: Benchmark
strategy:
fail-fast: false
matrix:
fixture: ${{ fromJson((github.event_name == 'push' && github.ref != 'refs/heads/main') && '["next", "astro", "vue", "svelte"]' || (inputs.fixtures || '["next", "astro", "vue", "svelte", "large", "babylon"]')) }}
variation: ${{ fromJson(inputs.variations || '["clean", "node_modules", "cache", "cache+node_modules", "cache+lockfile", "cache+lockfile+node_modules", "ci", "ci+setup", "lockfile", "lockfile+node_modules", "registry-clean", "registry-lockfile", "add-singleton", "remove-singleton", "add-overlap", "remove-overlap"]') }}
# Everything but registry-*, which runs per region in benchmark-registries.
variation: ${{ fromJson(needs.detect-changes.outputs.pm_variations) }}
include:
- variation: "build"
fixture: "next"
Expand All @@ -136,7 +159,6 @@ jobs:
fixture: "run"
permissions:
contents: read
id-token: write
env:
# rc.21 is advertised by the canary channel but its Linux ARM64 npm binary is missing.
BENCH_ZPM_VERSION: "6.0.0-rc.20"
Expand All @@ -157,24 +179,6 @@ jobs:
working-directory: suite
run: |
bash ./scripts/setup.sh
- name: Configure AWS Credentials
if: startsWith(matrix.variation, 'registry-')
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
- name: Get CodeArtifact Token
if: startsWith(matrix.variation, 'registry-')
id: aws
run: |
CODEARTIFACT_AUTH_TOKEN=$(aws codeartifact get-authorization-token \
--domain vlt \
--domain-owner 451504312483 \
--region us-east-1 \
--query authorizationToken \
--output text)
echo "::add-mask::$CODEARTIFACT_AUTH_TOKEN"
echo "token=$CODEARTIFACT_AUTH_TOKEN" >> "$GITHUB_OUTPUT"
- name: Tune benchmark settings
id: tune
run: |
Expand All @@ -192,18 +196,96 @@ jobs:
;;
esac

# Registry variations also get reduced runs (6 registries × iterations must fit in 90min)
case "${{ matrix.variation }}" in
registry-*)
warmup=1
runs=3
echo "Registry variation detected — using warmup=$warmup, runs=$runs"
;;
esac

echo "warmup=$warmup" >> "$GITHUB_OUTPUT"
echo "runs=$runs" >> "$GITHUB_OUTPUT"
- name: Run Benchmarks variations
env:
BENCH_WARMUP: ${{ steps.tune.outputs.warmup }}
BENCH_RUNS: ${{ steps.tune.outputs.runs }}
run: |
./suite/bench run \
--fixtures="${{ matrix.fixture }}" \
--variation="${{ matrix.variation }}"
- name: Upload Benchmark Results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: results-${{ matrix.fixture }}-${{ matrix.variation }}
path: ./suite/results/${{ matrix.fixture }}/${{ matrix.variation }}/
retention-days: 7
- name: Upload Versions Info
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: versions-${{ matrix.fixture }}-${{ matrix.variation }}
path: ./suite/results/versions.json
retention-days: 7

benchmark-registries:
# The registry-* variations, once per region. A registry benchmark measures
# the network between the runner and each registry, so where the runner
# sits is part of the result: each region's jobs run on a runner pinned to
# that region (REGISTRY_RUNNERS; see docs/METHODOLOGY.md#regions) and
# record where they actually landed (runner.json -> regions.json).
name: "Run Registry Benchmarks (${{ matrix.region }})"
runs-on: ${{ matrix.runner }}
needs: [detect-changes]
if: needs.detect-changes.outputs.skip_benchmarks != 'true' && needs.detect-changes.outputs.registry_jobs != '0'
timeout-minutes: 120
environment: Benchmark
# A region other than the default must not cost the night's results: if
# its runners break, the other regions and every package manager still
# publish, and that region's numbers are simply missing for the day.
continue-on-error: ${{ matrix.region != 'na' }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.detect-changes.outputs.registry_matrix) }}
permissions:
contents: read
id-token: write
env:
# rc.21 is advertised by the canary channel but its Linux ARM64 npm binary is missing.
BENCH_ZPM_VERSION: "6.0.0-rc.20"
BENCH_INCLUDE: ${{ fromJson(inputs.binaries || '"npm,yarn,berry,zpm,pnpm,vlt,bun,deno,aube,upm,nx,turbo,vp,node"') }}
BENCH_REGION: ${{ matrix.region }}
BENCH_REGION_LABEL: ${{ matrix.label }}
steps:
- uses: actions/checkout@v6
- name: Install Node
uses: actions/setup-node@v6
with:
node-version: "26"
package-manager-cache: false
- name: Install & Setup Tools
working-directory: suite
run: |
bash ./scripts/setup.sh
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
# Where the CodeArtifact domain is, not where the runner is.
aws-region: us-east-1
- name: Get CodeArtifact Token
id: aws
run: |
CODEARTIFACT_AUTH_TOKEN=$(aws codeartifact get-authorization-token \
--domain vlt \
--domain-owner 451504312483 \
--region us-east-1 \
--query authorizationToken \
--output text)
echo "::add-mask::$CODEARTIFACT_AUTH_TOKEN"
echo "token=$CODEARTIFACT_AUTH_TOKEN" >> "$GITHUB_OUTPUT"
- name: Tune benchmark settings
id: tune
run: |
# Registry variations always run warmup=1, runs=3, whatever the
# inputs: 6 registries × iterations must fit in the timeout. (The
# same override the single benchmark job applied before the split.)
echo "warmup=1" >> "$GITHUB_OUTPUT"
echo "runs=3" >> "$GITHUB_OUTPUT"
- name: Run Registry Benchmarks
env:
VLT_REGISTRY: https://registry.vlt.io/vlt-benchmarks/npm/
VLT_TOKEN: ${{ secrets.VLT_REGISTRY_AUTH_TOKEN }}
Expand All @@ -220,25 +302,46 @@ jobs:
./suite/bench run \
--fixtures="${{ matrix.fixture }}" \
--variation="${{ matrix.variation }}"
- name: Record where this job ran
# After the benchmark, never before: it sends one request to each
# registry, which must not warm anything the benchmark measures.
if: ${{ !cancelled() }}
env:
BENCH_FIXTURE: ${{ matrix.fixture }}
BENCH_VARIATION: ${{ matrix.variation }}
VLT_TOKEN: ${{ secrets.VLT_REGISTRY_AUTH_TOKEN }}
CODEARTIFACT_AUTH_TOKEN: ${{ steps.aws.outputs.token }}
CLOUDSMITH_REGISTRY: ${{ secrets.CLOUDSMITH_REGISTRY }}
CLOUDSMITH_TOKEN: ${{ secrets.CLOUDSMITH_TOKEN }}
GH_REGISTRY: ${{ secrets.GH_REGISTRY }}
GH_AUTH_TOKEN: ${{ secrets.GH_AUTH_TOKEN }}
JFROG_REGISTRY: ${{ secrets.JFROG_REGISTRY }}
JFROG_TOKEN: ${{ secrets.JFROG_TOKEN }}
run: |
bash suite/scripts/registry/runner-info.sh suite/scripts \
"suite/results/${{ matrix.fixture }}/${{ matrix.name }}/runner.json"
- name: Upload Benchmark Results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: results-${{ matrix.fixture }}-${{ matrix.variation }}
path: ./suite/results/${{ matrix.fixture }}/${{ matrix.variation }}/
name: results-${{ matrix.fixture }}-${{ matrix.name }}
path: ./suite/results/${{ matrix.fixture }}/${{ matrix.name }}/
retention-days: 7
- name: Upload Versions Info
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: versions-${{ matrix.fixture }}-${{ matrix.variation }}
name: versions-${{ matrix.fixture }}-${{ matrix.name }}
path: ./suite/results/versions.json
retention-days: 7

process:
name: "Process Results"
runs-on: ubuntu-24.04-arm
needs: [detect-changes, benchmark]
if: needs.detect-changes.outputs.skip_benchmarks != 'true'
needs: [detect-changes, benchmark, benchmark-registries]
# !failure() rather than the implicit success(): a dispatch can ask for
# only one kind of benchmark, and the other kind's job is then skipped.
if: ${{ !cancelled() && !failure() && needs.detect-changes.outputs.skip_benchmarks != 'true' }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
Expand Down Expand Up @@ -271,11 +374,12 @@ jobs:
const failures = []

for (const entry of fs.readdirSync('suite/results').sort()) {
const match = /^results-(.+)-(registry-[a-z]+)$/.exec(entry)
// results-<fixture>-registry-<kind>[@<region>]
const match = /^results-(.+?)-(registry-[a-z]+)(?:@([a-z]{2,8}))?$/.exec(entry)
if (!match) continue
const file = path.join('suite/results', entry, 'benchmarks.json')
if (!fs.existsSync(file)) continue
const label = `${match[1]} ${match[2]}`
const label = `${match[1]} ${match[2]} (${match[3] ?? 'na'})`

const vlt = (JSON.parse(fs.readFileSync(file, 'utf8')).results ?? [])
.find((r) => r.command === 'vlt')
Expand Down Expand Up @@ -367,9 +471,10 @@ jobs:
// registry name rather than a package manager.
const dir = 'suite/results/latest'
for (const entry of fs.readdirSync(dir).sort()) {
const match = /^(.+)-(registry-[a-z]+)\.json$/.exec(entry)
// <fixture>-registry-<kind>[@<region>].json
const match = /^(.+?)-(registry-[a-z]+)(?:@([a-z]{2,8}))?\.json$/.exec(entry)
if (!match) continue
const label = `${match[1]} ${match[2]}`
const label = `${match[1]} ${match[2]} (${match[3] ?? 'na'})`

// Registries where every run failed are stamped with a non-zero
// exit code and a zero mean by clean-benchmarks and rendered as
Expand Down Expand Up @@ -444,6 +549,7 @@ jobs:
needs:
- detect-changes
- benchmark
- benchmark-registries
- process
- deploy
steps:
Expand All @@ -463,5 +569,6 @@ jobs:
The benchmark run failed and needs to be retriggered.
Detect Changes: ${{ needs.detect-changes.result }}
Benchmark: ${{ needs.benchmark.result }}
Registry benchmarks: ${{ needs.benchmark-registries.result }}
Process: ${{ needs.process.result }}
Deploy: ${{ needs.deploy.result }}
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ taking no new measurements.
## Environment

We currently only test a `linux` runner, the most common GitHub Actions
environment. The workflow label is read from the workflows themselves — all six
benchmark jobs in `.github/workflows/benchmark.yaml` and
`.github/workflows/reprocess.yml` set `runs-on: ubuntu-24.04-arm`:
environment. The workflow label is read from the workflows themselves — every
package-manager and task-runner job in `.github/workflows/benchmark.yaml`, and
every job in `.github/workflows/reprocess.yml`, sets `runs-on: ubuntu-24.04-arm`:

- Workflow label: `ubuntu-24.04-arm`
- VM: Linux (Ubuntu 24.04)
Expand All @@ -39,6 +39,11 @@ not measurements taken here.
> producing the numbers. If you are comparing these results against your own,
> that difference matters more than any of the figures above.

The registry benchmarks are the exception: they run once **per region**
(North America and Europe), each on a runner pinned to that region by the
`REGISTRY_RUNNERS` repository variable, and record where they actually ran.
See [Regions in docs/METHODOLOGY.md](docs/METHODOLOGY.md#regions).

We may add Mac/Windows in the future but it will likely exponentially increase the already slow run time of the suite (**~40min**).

## Overview
Expand Down Expand Up @@ -106,12 +111,17 @@ Registry benchmarking is available in the `registry-clean` and `registry-lockfil

- `npm` (`https://registry.npmjs.org/`)
- `vlt` (`https://registry.vlt.io/vlt-benchmarks/npm/`)
- `aws` (CodeArtifact benchmark registry)
- `aws` (CodeArtifact benchmark registry, `us-east-1`)
- `cloudsmith` (`CLOUDSMITH_REGISTRY`)
- `github` (GitHub Packages, `GH_REGISTRY`)
- `jfrog` (JFrog Artifactory, `JFROG_REGISTRY`)

Defaults:

- Local and CI run `npm,vlt,aws` by default for `registry-*` variations.
- Local and CI run all six by default for `registry-*` variations.
- You can limit registries with `--registries` (wrapper) or `BENCH_INCLUDE_REGISTRY` (script-level env).
- `--region=<id>` (or `BENCH_REGION`) files the results under that region
(`<variation>@<region>`); it does not move the machine. CI sets it per region.

Examples:

Expand All @@ -123,6 +133,11 @@ Examples:
CODEARTIFACT_AUTH_TOKEN=<token> ./suite/bench run --variation=registry-clean --fixtures=next --registries=aws
```

```bash
# File a run as Europe's (from a machine that is actually in Europe)
./suite/bench run --variation=registry-clean --fixtures=next --registries=npm,vlt --region=eu
```

Auth notes:

- `aws` requires `CODEARTIFACT_AUTH_TOKEN`.
Expand Down
Loading
Loading