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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
123 changes: 116 additions & 7 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,63 @@ on:
description: 'Number of times to repeat each scenario'
type: number
required: true
default: 3
default: 1
demos:
description: 'Comma-separated demos to benchmark (app0, entry-points, entry-points-css). Leave empty to only run the experiments'
type: string
required: false
default: 'app0,entry-points,entry-points-css'
modes:
description: 'Comma-separated modes to benchmark (source, ng-packagr, library)'
type: string
required: true
default: 'source,ng-packagr,library'
parallel:
description: 'Nx tasks to run at once. Building 3 entry-points apps from source at once needs ~17 GB, more than the 16 GB runner has'
type: number
required: true
default: 2
experiments:
description: 'Also run the memory and builder-factor experiments'
type: boolean
required: true
default: true

permissions:
contents: read

env:
# Building an app from source compiles every lib and exceeds Node's default heap
NODE_OPTIONS: --max-old-space-size=8192

jobs:
matrix:
runs-on: ubuntu-latest
outputs:
include: ${{ steps.matrix.outputs.include }}
steps:
- id: matrix
run: |
node -e '
const split = (value) => value.split(",").map((item) => item.trim()).filter(Boolean);
const include = split(process.env.DEMOS).flatMap((demo) => split(process.env.MODES).map((mode) => ({ demo, mode })));
require("fs").appendFileSync(process.env.GITHUB_OUTPUT, `include=${JSON.stringify(include)}\n`);
'
env:
DEMOS: ${{ inputs.demos }}
MODES: ${{ inputs.modes }}

# One job per demo and mode, so the slow combinations run in parallel on separate runners
benchmark:
needs: matrix
if: needs.matrix.outputs.include != '[]'
name: ${{ matrix.demo }} · ${{ matrix.mode }}
runs-on: ubuntu-latest
timeout-minutes: 120
env:
# The app build compiles the generated libs from source and exceeds Node's default heap
NODE_OPTIONS: --max-old-space-size=8192
timeout-minutes: 300
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.matrix.outputs.include) }}
steps:
- uses: actions/checkout@v4

Expand All @@ -29,13 +74,77 @@ jobs:

- run: npm ci --legacy-peer-deps

- run: node tools/benchmark.mjs --iterations="$ITERATIONS"
- run: node tools/benchmark.mjs --iterations="$ITERATIONS" --demos="$DEMO" --modes="$MODE" --parallel="$PARALLEL"
env:
ITERATIONS: ${{ inputs.iterations }}
DEMO: ${{ matrix.demo }}
MODE: ${{ matrix.mode }}
PARALLEL: ${{ inputs.parallel }}

- uses: actions/upload-artifact@v4
if: always()
with:
name: benchmark-results
name: benchmark-${{ matrix.demo }}-${{ matrix.mode }}
path: tmp/benchmark
if-no-files-found: ignore

report:
needs: [matrix, benchmark]
if: always() && needs.matrix.outputs.include != '[]'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 24

- uses: actions/download-artifact@v4
with:
pattern: benchmark-*
path: results

- run: node tools/benchmark.mjs --report=results

- uses: actions/upload-artifact@v4
with:
name: benchmark-report
path: tmp/benchmark

experiments:
if: inputs.experiments
name: experiment · ${{ matrix.experiment }}
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
# Separate jobs, so a runner that runs out of memory only loses that experiment.
# memory-parallel-limit builds six apps from source three at a time, which needs more than 16 GB.
experiment: [memory-default-heap, memory-threads, memory-heap, memory-parallel, memory-parallel-limit, factors]
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'

- run: npm ci --legacy-peer-deps

- if: startsWith(matrix.experiment, 'memory-')
run: node tools/memory-experiments.mjs --experiments="${EXPERIMENT#memory-}"
env:
EXPERIMENT: ${{ matrix.experiment }}

- if: matrix.experiment == 'factors'
run: node tools/builder-factors.mjs

- uses: actions/upload-artifact@v4
if: always()
with:
name: experiment-${{ matrix.experiment }}
path: |
tmp/memory
tmp/factors
if-no-files-found: ignore
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,6 @@ vitest.config.*.timestamp*
.claude/worktrees
.nx/polygraph
.nx/self-healing
.nx/migrate-runs
.nx/migrate-runs
# Upstream Angular sources for reference
/.repos
Loading
Loading