Skip to content

Commit 4a05874

Browse files
committed
better overhead table
1 parent 1778b2a commit 4a05874

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

dev-packages/node-overhead-gh-action/lib/Formatter.mjs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const NODE_OVERHEAD_RESULTS_HEADER = ['Scenario', 'Prev Requests/s', 'New Requests/s', 'Change %'];
1+
const NODE_OVERHEAD_RESULTS_HEADER = ['Scenario', 'Requests/s', '% of Baseline', 'Prev Requests/s', 'Change %'];
22

33
export class Formatter {
44
formatPercentageChange(base = 0, current = 0) {
@@ -24,8 +24,14 @@ export class Formatter {
2424
return `${formatted}%`;
2525
}
2626

27-
formatResult(name, base, current) {
28-
return [name, base, current, this.formatPercentageChange(base, current)];
27+
formatResult(name, base, current, baseline) {
28+
return [
29+
name,
30+
current || '-',
31+
baseline != null ? this.formatPercentageChange(baseline, current) : '-',
32+
base || '-',
33+
this.formatPercentageChange(base, current),
34+
];
2935
}
3036

3137
hasChanges(base, current, threshold = 0) {
@@ -50,11 +56,18 @@ export class Formatter {
5056
formatResults(base, current) {
5157
const headers = NODE_OVERHEAD_RESULTS_HEADER;
5258

59+
const baseline = current?.baseline;
60+
5361
return [
5462
headers,
5563
this.formatResult('Baseline', base?.baseline, current?.baseline),
56-
this.formatResult('With Sentry', base?.withInstrument, current?.withInstrument),
57-
this.formatResult('With Sentry (error only)', base?.withInstrumentErrorOnly, current?.withInstrumentErrorOnly),
64+
this.formatResult('With Sentry', base?.withInstrument, current?.withInstrument, baseline),
65+
this.formatResult(
66+
'With Sentry (error only)',
67+
base?.withInstrumentErrorOnly,
68+
current?.withInstrumentErrorOnly,
69+
baseline,
70+
),
5871
];
5972
}
6073
}

0 commit comments

Comments
 (0)