-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (83 loc) · 3.03 KB
/
Copy pathperformance.yml
File metadata and controls
96 lines (83 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Performance
on:
push:
branches: [main]
# On pull requests too. This only ran on main, so when a benchmark stopped
# compiling the branch went green, merged, and main went red: eight commits
# in a row before anyone looked at the commit list.
pull_request:
schedule:
- cron: '0 6 * * 1'
workflow_dispatch:
concurrency:
group: performance-ratchet-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: read
jobs:
ratchet:
name: edit-loop and runtime ratchet
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: cargo test --release performance ratchet
id: measure
env:
# Absolute: cargo runs the test binary from the package directory, not the workspace root.
DEED_PERF_RESULTS: ${{ github.workspace }}/performance-results.json
run: >
cargo test --release -p deed-driver --test performance_regression
existing_bench_slopes_stay_inside_the_ratchet
-- --ignored --exact --nocapture --test-threads=1
- name: summarize the measured slopes
if: always()
env:
MEASURE_OUTCOME: ${{ steps.measure.outcome }}
run: |
python3 - <<'PY'
import json
import os
from pathlib import Path
path = Path("performance-results.json")
if not path.exists():
# The test writes this before it asserts, so a step that passed wrote one.
if os.environ["MEASURE_OUTCOME"] == "success":
raise SystemExit(f"{path} is missing after the ratchet passed")
raise SystemExit(0)
data = json.loads(path.read_text())
edit = data["edit_loop"]
passes = edit["passes_us_per_file"]
logs = data["logs_report"]
rows = [
(
"edit loop total",
f"{edit['total_us_per_file']:.2f} us/file",
f"{edit['total_segment_ratio']:.2f}x",
)
]
rows += [
(f"edit loop {name}", f"{passes[name]:.2f} us/file", "")
for name in ("lex", "parse", "resolve", "typeck", "effects")
]
rows.append(
(
"logs report",
f"{logs['us_per_line']:.2f} us/line",
f"{logs['segment_ratio']:.2f}x",
)
)
with open(os.environ["GITHUB_STEP_SUMMARY"], "a", encoding="utf-8") as out:
out.write("## Performance ratchet\n\n")
out.write("| measurement | slope | segment ratio |\n")
out.write("| --- | ---: | ---: |\n")
for measurement, slope, ratio in rows:
out.write(f"| {measurement} | {slope} | {ratio} |\n")
PY
- uses: actions/upload-artifact@v7
if: always()
with:
name: performance-results
path: performance-results.json
if-no-files-found: warn