From 74c269c29a452076526fc0c36a64603e7aff79f3 Mon Sep 17 00:00:00 2001
From: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Date: Thu, 8 Jun 2017 18:30:57 +0300
Subject: [PATCH 1/2] benchmark: take RegExp creation out of cycle

---
 benchmark/common.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/benchmark/common.js b/benchmark/common.js
index bc9c21b3902ad7..622d053e5f9ee6 100644
--- a/benchmark/common.js
+++ b/benchmark/common.js
@@ -40,9 +40,10 @@ function Benchmark(fn, configs, options) {
 Benchmark.prototype._parseArgs = function(argv, configs) {
   const cliOptions = {};
   const extraOptions = {};
+  const validArgRE = /^(.+?)=([\s\S]*)$/;
   // Parse configuration arguments
   for (const arg of argv) {
-    const match = arg.match(/^(.+?)=([\s\S]*)$/);
+    const match = arg.match(validArgRE);
     if (!match) {
       console.error(`bad argument: ${arg}`);
       process.exit(1);

From 51459b38206e8adec0afdbc5df8b475ae6d49bed Mon Sep 17 00:00:00 2001
From: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Date: Thu, 8 Jun 2017 18:36:17 +0300
Subject: [PATCH 2/2] benchmark: use test(), not match() in bool context

---
 benchmark/buffers/buffer-write.js          | 2 +-
 benchmark/crypto/cipher-stream.js          | 2 +-
 benchmark/crypto/hash-stream-creation.js   | 2 +-
 benchmark/crypto/hash-stream-throughput.js | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/benchmark/buffers/buffer-write.js b/benchmark/buffers/buffer-write.js
index 758c8b8b514e3f..2f1eb08763b241 100644
--- a/benchmark/buffers/buffer-write.js
+++ b/benchmark/buffers/buffer-write.js
@@ -52,7 +52,7 @@ function main(conf) {
   var buff = new clazz(8);
   var fn = `write${conf.type}`;
 
-  if (fn.match(/Int/))
+  if (/Int/.test(fn))
     benchInt(buff, fn, len, noAssert);
   else
     benchFloat(buff, fn, len, noAssert);
diff --git a/benchmark/crypto/cipher-stream.js b/benchmark/crypto/cipher-stream.js
index 90bf548c76cdbb..9fd88f1d864dff 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 296127ab3846e2..dfab32c8af7ea1 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 dbb2e5c99958d3..cedaeb872f494d 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';