Improve format of benchmark results (#48881)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48881

Changelog: [internal]

Small improvement in the printed benchmark results.

Reviewed By: andrewdacenko

Differential Revision: D68552379

fbshipit-source-id: 39312a757a9de57e462c17a9f1455dfe8cab53f1
This commit is contained in:
Rubén Norte
2025-01-23 10:26:47 -08:00
committed by Facebook GitHub Bot
parent c5bab82a60
commit 8702ed5f37
+6 -2
View File
@@ -120,10 +120,14 @@ function printBenchmarkResults(bench: Bench) {
(maxLength, task) => Math.max(maxLength, task.name.length),
0,
);
const separatorWidth = 121 + longestTaskNameLength - 'Task name'.length;
const separatorWidth = 137 + longestTaskNameLength - 'Task name'.length;
const benchmarkName = bench.name ?? 'Benchmark';
console.log('-'.repeat(separatorWidth));
console.log(bench.name);
console.log(
`| ${benchmarkName}${' '.repeat(separatorWidth - (4 + benchmarkName.length))} |`,
);
console.log('-'.repeat(separatorWidth));
console.table(nullthrows(bench.table()));
console.log('-'.repeat(separatorWidth) + '\n');
}