Skip to content

Commit d76fc15

Browse files
fix: remove trailing whitespace from iai-callgrind.yml
Co-authored-by: samueltardieu <[email protected]>
1 parent f391c91 commit d76fc15

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

.github/workflows/iai-callgrind.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -71,32 +71,32 @@ jobs:
7171
python3 << 'EOF'
7272
import re
7373
import os
74-
74+
7575
def parse_benchmark_output(filename):
7676
"""Parse iai-callgrind output and extract benchmark results."""
7777
benchmarks = {}
7878
try:
7979
with open(filename, 'r') as f:
8080
content = f.read()
81-
81+
8282
# Pattern to match benchmark names and their metrics
8383
benchmark_pattern = r'([^\n]+?)::[^\n]+?::([^\n]+?)\n\s+Instructions:\s+(\d+)'
84-
84+
8585
for match in re.finditer(benchmark_pattern, content):
8686
bench_name = f"{match.group(1)}::{match.group(2)}"
8787
instructions = int(match.group(3))
8888
benchmarks[bench_name] = instructions
8989
except FileNotFoundError:
9090
pass
91-
91+
9292
return benchmarks
93-
93+
9494
baseline = parse_benchmark_output('baseline-output.txt')
9595
pr_results = parse_benchmark_output('pr-output.txt')
96-
96+
9797
# Create markdown comment
9898
comment = "## 📊 iai-callgrind Benchmark Results\n\n"
99-
99+
100100
if not baseline:
101101
comment += "⚠️ **No baseline benchmarks found.** This may be the first time these benchmarks are run on the base branch.\n\n"
102102
comment += "### PR Branch Results\n\n"
@@ -110,21 +110,21 @@ jobs:
110110
regressions = []
111111
unchanged = []
112112
new_benchmarks = []
113-
113+
114114
for name, pr_instr in sorted(pr_results.items()):
115115
if name in baseline:
116116
base_instr = baseline[name]
117117
diff = pr_instr - base_instr
118118
pct_change = (diff / base_instr) * 100 if base_instr > 0 else 0
119-
119+
120120
result = {
121121
'name': name,
122122
'base': base_instr,
123123
'pr': pr_instr,
124124
'diff': diff,
125125
'pct': pct_change
126126
}
127-
127+
128128
if abs(pct_change) < 0.1: # Less than 0.1% change
129129
unchanged.append(result)
130130
elif diff < 0:
@@ -133,7 +133,7 @@ jobs:
133133
regressions.append(result)
134134
else:
135135
new_benchmarks.append({'name': name, 'pr': pr_instr})
136-
136+
137137
# Summary
138138
if regressions:
139139
comment += f"### ⚠️ {len(regressions)} Regression(s) Detected\n\n"
@@ -142,15 +142,15 @@ jobs:
142142
for r in sorted(regressions, key=lambda x: abs(x['pct']), reverse=True):
143143
comment += f"| `{r['name']}` | {r['base']:,} | {r['pr']:,} | +{r['diff']:,} | +{r['pct']:.2f}% |\n"
144144
comment += "\n"
145-
145+
146146
if improvements:
147147
comment += f"### ✅ {len(improvements)} Improvement(s)\n\n"
148148
comment += "| Benchmark | Base | PR | Change | % |\n"
149149
comment += "|-----------|------|----|---------|\n"
150150
for r in sorted(improvements, key=lambda x: abs(x['pct']), reverse=True):
151151
comment += f"| `{r['name']}` | {r['base']:,} | {r['pr']:,} | {r['diff']:,} | {r['pct']:.2f}% |\n"
152152
comment += "\n"
153-
153+
154154
if unchanged:
155155
comment += f"### ➡️ {len(unchanged)} Unchanged (within ±0.1%)\n\n"
156156
comment += "<details><summary>Click to expand</summary>\n\n"
@@ -159,25 +159,25 @@ jobs:
159159
for r in unchanged:
160160
comment += f"| `{r['name']}` | {r['pr']:,} |\n"
161161
comment += "\n</details>\n\n"
162-
162+
163163
if new_benchmarks:
164164
comment += f"### 🆕 {len(new_benchmarks)} New Benchmark(s)\n\n"
165165
comment += "| Benchmark | Instructions |\n"
166166
comment += "|-----------|-------------|\n"
167167
for nb in new_benchmarks:
168168
comment += f"| `{nb['name']}` | {nb['pr']:,} |\n"
169169
comment += "\n"
170-
170+
171171
if not regressions and not improvements and not new_benchmarks:
172172
comment += "### ✅ All benchmarks unchanged\n\n"
173-
173+
174174
comment += "\n---\n"
175175
comment += "*iai-callgrind measures instructions executed, which is deterministic and not affected by system load.*\n"
176-
176+
177177
# Write to file
178178
with open('comment.txt', 'w') as f:
179179
f.write(comment)
180-
180+
181181
print("Comment generated successfully")
182182
EOF
183183
@@ -188,19 +188,19 @@ jobs:
188188
script: |
189189
const fs = require('fs');
190190
const comment = fs.readFileSync('comment.txt', 'utf8');
191-
191+
192192
// Find existing comment
193193
const { data: comments } = await github.rest.issues.listComments({
194194
owner: context.repo.owner,
195195
repo: context.repo.repo,
196196
issue_number: context.issue.number,
197197
});
198-
199-
const botComment = comments.find(comment =>
200-
comment.user.type === 'Bot' &&
198+
199+
const botComment = comments.find(comment =>
200+
comment.user.type === 'Bot' &&
201201
comment.body.includes('iai-callgrind Benchmark Results')
202202
);
203-
203+
204204
if (botComment) {
205205
// Update existing comment
206206
await github.rest.issues.updateComment({

0 commit comments

Comments
 (0)