From 38253af349b87c20a8ea086eaf5ba7cda4a31afb Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Fri, 16 Jun 2017 18:04:33 +0300 Subject: [PATCH] benchmark: remove needless RegExp capturing Use non-capturing grouping or remove capturing completely when: * capturing is useless per se, e.g. in test() check; * captured groups are not used afterwards at all; * some of the later captured groups are not used afterwards. PR-URL: https://github.com/nodejs/node/pull/13718 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Refael Ackermann Reviewed-By: Luigi Pinca --- benchmark/common.js | 2 +- benchmark/run.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark/common.js b/benchmark/common.js index 622d053e5f9ee6..148f51830f7b8d 100644 --- a/benchmark/common.js +++ b/benchmark/common.js @@ -217,7 +217,7 @@ function formatResult(data) { } var rate = data.rate.toString().split('.'); - rate[0] = rate[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,'); + rate[0] = rate[0].replace(/(\d)(?=(?:\d\d\d)+(?!\d))/g, '$1,'); rate = (rate[1] ? rate.join('.') : rate[0]); return `${data.name}${conf}: ${rate}`; } diff --git a/benchmark/run.js b/benchmark/run.js index 3b4944caf5ce97..2b263a1a6cb573 100644 --- a/benchmark/run.js +++ b/benchmark/run.js @@ -60,7 +60,7 @@ if (format === 'csv') { console.log(`"${data.name}", "${conf}", ${data.rate}, ${data.time}`); } else { var rate = data.rate.toString().split('.'); - rate[0] = rate[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,'); + rate[0] = rate[0].replace(/(\d)(?=(?:\d\d\d)+(?!\d))/g, '$1,'); rate = (rate[1] ? rate.join('.') : rate[0]); console.log(`${data.name} ${conf}: ${rate}`); }