From 8702ed5f37659cd8a720f2caa3287626952f8a5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Thu, 23 Jan 2025 10:26:47 -0800 Subject: [PATCH] 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 --- packages/react-native-fantom/src/Benchmark.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/react-native-fantom/src/Benchmark.js b/packages/react-native-fantom/src/Benchmark.js index d8ff1fafeb3..ed3d451cd77 100644 --- a/packages/react-native-fantom/src/Benchmark.js +++ b/packages/react-native-fantom/src/Benchmark.js @@ -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'); }