Skip to content

Commit 6bfc118

Browse files
rubennortefacebook-github-bot
authored andcommitted
Improve formatting for benchmark output (facebook#52106)
Summary: Pull Request resolved: facebook#52106 Changelog: [internal] This slightly improves the formatting of the output produced by benchmarks, so we can just copy&paste the result to share it as valid Markdown. Reviewed By: christophpurrer Differential Revision: D76898244 fbshipit-source-id: dc1040ee3787c7f0dcb747c9fba8eb14086a0087
1 parent 29704b1 commit 6bfc118

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

private/react-native-fantom/src/Benchmark.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -172,20 +172,12 @@ export function suite(
172172

173173
function printBenchmarkResults(bench: Bench) {
174174
const {fantomConfigSummary} = getConstants();
175-
const longestTaskNameLength = bench.tasks.reduce(
176-
(maxLength, task) => Math.max(maxLength, task.name.length),
177-
0,
178-
);
179-
const separatorWidth = 137 + longestTaskNameLength - 'Task name'.length;
180175
const benchmarkName =
181176
(bench.name ?? 'Benchmark') +
182177
(fantomConfigSummary ? ` (${fantomConfigSummary})` : '');
183178

184-
console.log('-'.repeat(separatorWidth));
185-
console.log(
186-
`| ${benchmarkName}${' '.repeat(separatorWidth - (4 + benchmarkName.length))} |`,
187-
);
188-
console.log('-'.repeat(separatorWidth));
179+
console.log('');
180+
console.log(`### ${benchmarkName} ###`);
189181
console.table(nullthrows(bench.table()));
190-
console.log('-'.repeat(separatorWidth) + '\n');
182+
console.log('');
191183
}

0 commit comments

Comments
 (0)