diff options
author | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2017-06-08 18:30:57 +0300 |
---|---|---|
committer | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2017-06-12 12:10:22 +0300 |
commit | 8beff648518aa8e846221d03e31bea5f78f62010 (patch) | |
tree | 7ad9a821d4ef0e70647eaf77e5cd7d18b9a7beea /benchmark/crypto | |
parent | a2ed3a9c88c722a4ebbcdb5e6ffb59447d939507 (diff) | |
download | android-node-v8-8beff648518aa8e846221d03e31bea5f78f62010.tar.gz android-node-v8-8beff648518aa8e846221d03e31bea5f78f62010.tar.bz2 android-node-v8-8beff648518aa8e846221d03e31bea5f78f62010.zip |
benchmark: fix some RegExp nits
* 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 <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'benchmark/crypto')
-rw-r--r-- | benchmark/crypto/cipher-stream.js | 2 | ||||
-rw-r--r-- | benchmark/crypto/hash-stream-creation.js | 2 | ||||
-rw-r--r-- | benchmark/crypto/hash-stream-throughput.js | 2 |
3 files changed, 3 insertions, 3 deletions
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'; |