Benchmarking and reporting tool for Lean verification projects. Tracks file-by-file build times, the longest pole, and slow declarations/proofs.
Three GitHub Actions workflows are provided.
- benchmarks on pushes to main
!benchon PRs- Weekly issue reports
A runner script (bench.sh) collects metrics using lakeprof and
Lean's trace profiler, then uploads results to a storage and reporting server.
Here's a brief setup guide for getting the benchmarking and profiling infrastructure working.
Deploy the benchwarmer-server binary to a host reachable from GitHub. A few environment variables
need to be set for the running process:
BENCH_AUTH_TOKENS: Comma-separated list of valid authentication tokensBENCHWARMER_DATA_DIR(optional, default is./data): Directory for storing artifactsBENCHWARMER_ADDR(optional, default is0.0.0.0:3000): Bind address for the serverBENCHWARMER_BASE_URL(optional): Public base URL of the server (e.g.https://benchmark.mpenciak.net). When set, reports include a Perfetto UI link for viewing trace data.
The server stores artifacts at $(BENCHWARMER_DATA_DIR)/<org>/<repo>/<commit>/<run>.tar.gz.
Make sure the three workflows are available to the repository: bench-pr.yml, bench-main.yml,
bench-weekly.yml. Also ensure that ./runner/bench.sh is available.
Repository variables and secrets are required for posting the benchmarks:
BENCH_AUTH_TOKEN: Upload token (must match one entry in the server'sBENCH_AUTH_TOKENS)BENCH_API_ENDPOINT: Server base URL, e.g.https://benchmark.mpenciak.net
BENCH_LIBRARY_NAME: Lean library directory name (e.g.CurveDalek).BENCHWARMER_RUNNER_PATH(optional, defaultrunner: Path to the runner script directory.
Edit the benchmarking script for any necessary preprocessing steps for the benchmarks.
e.g.
echo "--- Preprocess ---"
lake exe cache get
lake build Aeneas
lake build PrimeCert| Method | Path | Auth | Description |
|---|---|---|---|
GET |
/health |
No | Health check, returns "ok" |
POST |
/{org}/{repo}/{commit-sha} |
Bearer token | Upload a benchmark artifact (tar.gz body) |
GET |
/{org}/{repo}/{commit-sha}/report/weekly |
No | Weekly markdown report |
GET |
/{org}/{repo}/{commit-sha}/report/pr?base={base-sha} |
No | Differential markdown report vs base commit |
GET |
/{org}/{repo}/{commit-sha}/trace |
No | Raw lakeprof.trace_event JSON file |
Report endpoints return JSON: {"markdown": "..."}. The trace endpoint returns application/json and has CORS enabled for https://ui.perfetto.dev.
workflows/: Contains the workflowsrunner/: Contains the runner script(s)server/: Contains the server code