From 8beff648518aa8e846221d03e31bea5f78f62010 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Thu, 8 Jun 2017 18:30:57 +0300 Subject: benchmark: fix some RegExp nits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Take RegExp creation out of cycle. * use test(), not match() in boolean context. PR-URL: https://github.com/nodejs/node/pull/13551 Reviewed-By: Colin Ihrig Reviewed-By: Refael Ackermann Reviewed-By: Tobias Nießen Reviewed-By: Luigi Pinca --- benchmark/crypto/cipher-stream.js | 2 +- benchmark/crypto/hash-stream-creation.js | 2 +- benchmark/crypto/hash-stream-throughput.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'benchmark/crypto') diff --git a/benchmark/crypto/cipher-stream.js b/benchmark/crypto/cipher-stream.js index 90bf548c76..9fd88f1d86 100644 --- a/benchmark/crypto/cipher-stream.js +++ b/benchmark/crypto/cipher-stream.js @@ -11,7 +11,7 @@ var bench = common.createBenchmark(main, { function main(conf) { var api = conf.api; - if (api === 'stream' && process.version.match(/^v0\.[0-8]\./)) { + if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) { console.error('Crypto streams not available until v0.10'); // use the legacy, just so that we can compare them. api = 'legacy'; diff --git a/benchmark/crypto/hash-stream-creation.js b/benchmark/crypto/hash-stream-creation.js index 296127ab38..dfab32c8af 100644 --- a/benchmark/crypto/hash-stream-creation.js +++ b/benchmark/crypto/hash-stream-creation.js @@ -15,7 +15,7 @@ var bench = common.createBenchmark(main, { function main(conf) { var api = conf.api; - if (api === 'stream' && process.version.match(/^v0\.[0-8]\./)) { + if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) { console.error('Crypto streams not available until v0.10'); // use the legacy, just so that we can compare them. api = 'legacy'; diff --git a/benchmark/crypto/hash-stream-throughput.js b/benchmark/crypto/hash-stream-throughput.js index dbb2e5c999..cedaeb872f 100644 --- a/benchmark/crypto/hash-stream-throughput.js +++ b/benchmark/crypto/hash-stream-throughput.js @@ -14,7 +14,7 @@ var bench = common.createBenchmark(main, { function main(conf) { var api = conf.api; - if (api === 'stream' && process.version.match(/^v0\.[0-8]\./)) { + if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) { console.error('Crypto streams not available until v0.10'); // use the legacy, just so that we can compare them. api = 'legacy'; -- cgit v1.2.3