diff options
author | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2017-06-16 18:04:33 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-06-21 23:44:17 +0300 |
commit | 11f45623ace2bf9729d2851ca6851e35dbc2d9a5 (patch) | |
tree | b1b12f8a80f352c14d5ab7dc1fbeb7c65df2ce89 /benchmark | |
parent | d4a05b2d9c49d93a9dc3e33d7e4b0ddeaeac6089 (diff) |
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 <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/common.js | 2 | ||||
-rw-r--r-- | benchmark/run.js | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/benchmark/common.js b/benchmark/common.js index 622d053e5f9..148f51830f7 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 3b4944caf5c..2b263a1a6cb 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}`); } |