From 95dead9b1eb0dec1bc17c37386b5131f97776d46 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 19 Jun 2024 17:41:24 -0400 Subject: [PATCH] prevent div/0 --- benchmarking/compare/index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/benchmarking/compare/index.js b/benchmarking/compare/index.js index 8bb75ccc74..a5fc6d10a9 100644 --- a/benchmarking/compare/index.js +++ b/benchmarking/compare/index.js @@ -77,11 +77,13 @@ for (let i = 0; i < results[0].length; i += 1) { } } - console.group(`${metric}: fastest is ${branches[min_index]}`); - times.forEach((time, b) => { - console.log(`${branches[b]}: ${time.toFixed(2)}ms (${((time / min) * 100).toFixed(2)}%)`); - }); - console.groupEnd(); + if (min !== 0) { + console.group(`${metric}: fastest is ${branches[min_index]}`); + times.forEach((time, b) => { + console.log(`${branches[b]}: ${time.toFixed(2)}ms (${((time / min) * 100).toFixed(2)}%)`); + }); + console.groupEnd(); + } } console.groupEnd();