Skip to content

Add CI performance benchmark suite#223

Open
Max042004 wants to merge 2 commits into
sysprog21:mainfrom
Max042004:issue-195-recovered
Open

Add CI performance benchmark suite#223
Max042004 wants to merge 2 commits into
sysprog21:mainfrom
Max042004:issue-195-recovered

Conversation

@Max042004

@Max042004 Max042004 commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add a reproducible two-tier performance benchmark suite for detecting
regressions in pull requests.

  • Tier 1 runs pinned lmbench workloads for syscall, process, and
    filesystem latency.
  • Tier 2 measures Python startup, Git status, ripgrep, zstd, and Make
    against a deterministic committed corpus.
  • Results include medians and raw samples in structured JSON.
  • Baseline columns are prepared for elfuse, QEMU-based native Linux,
    and OrbStack.

CI integration

Add a benchmark leg to the self-hosted Apple Silicon runtime matrix.
The leg runs exclusively on the host to avoid interference from sibling
jobs, compares results in report-only mode, and uploads the JSON artifact.

Missing baseline metrics are treated as failures, preventing broken or
timed-out benchmarks from silently passing. Benchmark preparation and
cleanup commands are also bounded by timeouts.

The checked-in baseline has not yet been captured on the designated
self-hosted CI machine. It will be refreshed in a follow-up after the
benchmark leg is deployed and runner variance has been characterized.
Comparison therefore remains report-only for now.

Validation

  • Full cold run: approximately 10m 19s
  • Cached CI-equivalent run: approximately 9m 20s
  • Baseline match exits successfully
  • An injected 2x regression exits non-zero
  • A missing baseline metric exits non-zero
  • Benchmark output contains 9 lmbench and 6 application metrics

Closes #195


Summary by cubic

Adds a two-tier performance benchmark suite with a deterministic workload to catch syscall, process-startup, and app-level regressions. Runs on the self-hosted Apple Silicon runner under an exclusive host lock and posts a sanitized PR comment with benchmark deltas. (Issue #195)

  • New Features

    • tests/bench-suite.sh: Tier 1 lmbench (lat_syscall/lat_proc/lat_fs) and Tier 2 app workloads (git status, rg, make, zstd) with warmups; guest-side timing for qemu-aarch64 via tests/bench-timeit.c; writes medians+samples to build/bench-results*.json.
    • Deterministic tests/bench-corpus for stable Tier 2 inputs; excluded from formatting to preserve baselines. Fixtures fetch app tools and cross-compile pinned lmbench.
    • Baselines in tests/bench-baseline.json for elfuse-aarch64, qemu-aarch64, and orbstack. scripts/bench-compare.py flags regressions (tunable via BENCH_REGRESSION_THRESHOLD) and treats missing metrics as NEW by default; scripts/bench-promote.py refreshes baselines.
    • CI: make bench / make bench-ci; BENCH_ENV selects elfuse-aarch64 (default) | qemu-aarch64 | orbstack | native. Benchmark leg isolates measurements with scripts/ci-host-lock.sh. .github/workflows/bench-report.yml uses scripts/bench-report.py to publish a sanitized advisory PR comment from the uploaded report artifact. Docs in docs/testing.md.
  • Migration

    • Run: make bench (or BENCH_ENV=qemu-aarch64 make bench-ci).
    • Compare: scripts/bench-compare.py --report-only.
    • Refresh baselines: run make bench-ci per env, then scripts/bench-promote.py; commit the updated tests/bench-baseline.json.

Written for commit c2c8cbe. Summary will update on new commits.

Review in cubic

Performance results need a stable workload so source-data changes do
not look like runtime regressions. Add a small committed project split
across core, filesystem, and network modules for repeatable Git,
ripgrep, zstd, and Make measurements.

Keep the corpus separate because its contents define the benchmark and
should change only when baselines are deliberately regenerated.
cubic-dev-ai[bot]

This comment was marked as resolved.

cubic-dev-ai[bot]

This comment was marked as resolved.

@Max042004
Max042004 force-pushed the issue-195-recovered branch 2 times, most recently from c606264 to 899d081 Compare July 18, 2026 16:11
Comment thread tests/bench-corpus/README.md Outdated
@Max042004
Max042004 force-pushed the issue-195-recovered branch from 899d081 to 3a0517a Compare July 18, 2026 17:18
jserv

This comment was marked as resolved.

@jserv
jserv requested a review from henrybear327 July 19, 2026 07:12
@Max042004
Max042004 force-pushed the issue-195-recovered branch from 3a0517a to 653c5fd Compare July 19, 2026 09:36
@jserv

jserv commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Once the benchmark is complete, upload the results to GitHub Pages, as rv32emu-bench does.

@Max042004
Max042004 force-pushed the issue-195-recovered branch from 653c5fd to fb40607 Compare July 19, 2026 11:59
Comment thread .github/workflows/bench-report.yml Outdated
Comment thread tests/bench-corpus/README.md Outdated
Comment thread tests/bench-corpus/README.md Outdated
@Max042004
Max042004 force-pushed the issue-195-recovered branch from fb40607 to c5495eb Compare July 19, 2026 13:40

@henrybear327 henrybear327 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, LGTM. Just some nits, as the text / comment is bloating a bit I feel.

Thanks.

Comment thread .github/workflows/main.yml Outdated
@@ -345,7 +347,12 @@ jobs:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: rewrite the entire comment to make it clearer

Comment thread .github/workflows/main.yml Outdated
run_matrix: false
check_target: check-sanitizer
brew_pkgs: binutils
# Benchmark leg (issue #195): release build, two-tier suite

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Comment thread docs/testing.md
green `make check` covers BusyBox validation. Use `make test-busybox` to
iterate on a single applet failure without rerunning the unit suite.

## Performance Benchmarks

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: make the text concise

I think the current testing.md has grown to the size that's already too big and too complicated to read

@jserv

jserv commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Once the benchmark is complete, upload the results to GitHub Pages, as rv32emu-bench does.

I create elfuse-bench and @Max042004 can maintain it directly.

Functional tests do not reveal changes in syscall, process-startup, or
application-level performance. Add a two-tier suite so pull requests
produce repeatable measurements and expose regressions before merge.

Run pinned lmbench microbenchmarks and representative developer
workloads with warmups and median reporting. Store raw samples in JSON,
compare them with captured elfuse, QEMU Linux, and OrbStack baselines,
and treat missing baseline metrics as failures.

Run the suite exclusively on the self-hosted Apple Silicon machine to
avoid interference from sibling jobs. Keep comparison report-only until
runner variance is characterized, while retaining artifacts for review
and baseline refreshes.

Closes sysprog21#195
@Max042004
Max042004 force-pushed the issue-195-recovered branch from c5495eb to c2c8cbe Compare July 20, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI/CD performance benchmarking

3 participants