mirror of
https://github.com/leanprover/lean4.git
synced 2026-03-17 10:24:07 +00:00
Also refactor util.sh in the process, so test scripts become easier to write (inspired in part by lake's test suite).
33 lines
1021 B
Bash
Executable File
33 lines
1021 B
Bash
Executable File
#!/usr/bin/env bash
|
|
source ../../../env_bench.sh
|
|
|
|
rm -f measurements.jsonl
|
|
|
|
# Build dependencies first so their compilation isn't measured.
|
|
lake build Cases Driver Baseline
|
|
|
|
# Run benchmarks single-threaded for reproducible measurements.
|
|
LEAN_NUM_THREADS=1 lake build VCGenBench 2>&1 | tee vcgen.out
|
|
LEAN_NUM_THREADS=1 lake build BaselineBench 2>&1 | tee -a vcgen.out
|
|
|
|
# Parse lines like:
|
|
# AddSubCancel(1000): 528 ms, 1 VCs by grind: 245 ms, kernel: 446 ms
|
|
# into JSONL measurements.
|
|
python3 -c "
|
|
import json, re, sys
|
|
|
|
for line in open('vcgen.out'):
|
|
m = re.search(r'(\w+)\((\d+)\):\s+(\d+) ms.*kernel:\s+(\d+) ms', line)
|
|
if not m:
|
|
continue
|
|
case, n, vcgen_ms, kernel_ms = m.group(1), m.group(2), m.group(3), m.group(4)
|
|
for phase, val in [('vcgen', vcgen_ms), ('kernel', kernel_ms)]:
|
|
print(json.dumps({
|
|
'metric': f'mvcgen/sym/{case}/{n}/{phase}//wall-clock',
|
|
'value': int(val) / 1000,
|
|
'unit': 's'
|
|
}))
|
|
" >> measurements.jsonl
|
|
|
|
rm -f vcgen.out
|