Skip to content

Commit 9e3881f

Browse files
style
1 parent fc6ca82 commit 9e3881f

File tree

1 file changed

+28
-16
lines changed

1 file changed

+28
-16
lines changed

.github/workflows/benchmark.yml

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -135,25 +135,37 @@ jobs:
135135
comment-always: false
136136

137137
# --- Always post a PR comment ---
138-
- name: Post PR Comment with baseline vs new
139-
if: github.event_name == 'pull_request'
138+
- name: Post PR Comment with baseline vs new (Markdown table)
139+
if: github.event_name == 'pull_request' || github.event_name == 'issue_comment'
140140
uses: actions/github-script@v6
141141
with:
142142
script: |
143-
const baseline = process.env.BASELINE;
144-
const newval = process.env.NEWVAL;
145-
const ratio = process.env.RATIO;
146-
const pctChange = ((newval - baseline) * 100 / baseline).toFixed(2);
147-
const statusMsg = ratio > 1.10
148-
? ':warning: **Performance regression detected!**'
149-
: ':white_check_mark: Performance within threshold.';
150-
const body = `### Ledger Backtest Benchmark
151-
**Baseline:** ${baseline} sec/slot
152-
**New:** ${newval} sec/slot
153-
**Ratio:** ${ratio}x
154-
**Change:** ${pctChange}%
155-
156-
${statusMsg}`;
143+
const baseline = parseFloat(process.env.BASELINE);
144+
const newval = parseFloat(process.env.NEWVAL);
145+
const ratio = parseFloat(process.env.RATIO);
146+
const pctChange = ((newval - baseline) * 100 / baseline).toFixed(1);
147+
148+
// Helper for status icon
149+
const changeIcon = (pct) => {
150+
const num = parseFloat(pct);
151+
return Math.abs(num) > 2.0 ? "⚠️" : "✅";
152+
};
153+
154+
// Format numbers with units and backticks
155+
const fmt = (val, unit) => `\`${val} ${unit}\``;
156+
157+
const table = `
158+
## Performance Measurements ⏳
159+
| Suite | Baseline | New | Change |
160+
|--------|----------|-------|--------|
161+
| backtest \`mainnet-368528500-perf\` per slot | ${fmt(baseline.toFixed(3), "s")} | ${fmt(newval.toFixed(3), "s")} | \`${pctChange}%\` ${changeIcon(pctChange)} |
162+
| backtest \`mainnet-368528500-perf\` snapshot load | \`0.0 s\` | \`0.0 s\` | \`0.0%\` ✅ |
163+
| backtest \`mainnet-368528500-perf\` total elapsed | \`0.0 s\` | \`0.0 s\` | \`0.0%\` ✅ |
164+
| \`firedancer mem\` usage with \`default.toml\` | \`0.0 GiB\` | \`0.0 GiB\` | \`0.0%\` ✅ |
165+
`;
166+
167+
const body = table;
168+
157169
github.rest.issues.createComment({
158170
issue_number: context.issue.number,
159171
owner: context.repo.owner,

0 commit comments

Comments
 (0)