benchmark: use strict mode
authorRich Trott <rtrott@gmail.com>
Sat, 20 Feb 2016 01:03:16 +0000 (17:03 -0800)
committerMyles Borins <mborins@us.ibm.com>
Mon, 21 Mar 2016 20:07:09 +0000 (13:07 -0700)
Apply strict mode to benchmark code.

PR-URL: https://github.com/nodejs/node/pull/5773
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
78 files changed:
benchmark/arrays/var-int.js
benchmark/arrays/zero-float.js
benchmark/arrays/zero-int.js
benchmark/buffers/buffer-base64-decode.js
benchmark/buffers/buffer-base64-encode.js
benchmark/buffers/buffer-bytelength.js
benchmark/buffers/buffer-compare.js
benchmark/buffers/buffer-creation.js
benchmark/buffers/buffer-indexof.js
benchmark/buffers/buffer-iterate.js
benchmark/buffers/buffer-read.js
benchmark/buffers/buffer-slice.js
benchmark/buffers/buffer-write.js
benchmark/buffers/dataview-set.js
benchmark/common.js
benchmark/compare.js
benchmark/crypto/aes-gcm-throughput.js
benchmark/crypto/cipher-stream.js
benchmark/crypto/hash-stream-creation.js
benchmark/crypto/hash-stream-throughput.js
benchmark/crypto/rsa-encrypt-decrypt-throughput.js
benchmark/crypto/rsa-sign-verify-throughput.js
benchmark/events/ee-add-remove.js
benchmark/events/ee-emit-multi-args.js
benchmark/events/ee-emit.js
benchmark/events/ee-listener-count-on-prototype.js
benchmark/events/ee-listeners-many.js
benchmark/events/ee-listeners.js
benchmark/fs-write-stream-throughput.js
benchmark/fs/read-stream-throughput.js
benchmark/fs/readfile.js
benchmark/fs/write-stream-throughput.js
benchmark/http/chunked.js
benchmark/http/client-request-body.js
benchmark/http/cluster.js
benchmark/http/end-vs-write-end.js
benchmark/http/simple.js
benchmark/http_bench.js
benchmark/http_server_lag.js
benchmark/http_simple_auto.js
benchmark/idle_clients.js
benchmark/misc/child-process-read.js
benchmark/misc/domain-fn-args.js
benchmark/misc/function_call/index.js
benchmark/misc/module-loader.js
benchmark/misc/next-tick-breadth.js
benchmark/misc/next-tick-depth.js
benchmark/misc/spawn-echo.js
benchmark/misc/startup.js
benchmark/misc/string-creation.js
benchmark/misc/string-decoder.js
benchmark/misc/timers.js
benchmark/misc/url.js
benchmark/misc/v8-bench.js
benchmark/net/net-c2s-cork.js
benchmark/net/net-c2s.js
benchmark/net/net-pipe.js
benchmark/net/net-s2c.js
benchmark/net/tcp-raw-c2s.js
benchmark/net/tcp-raw-pipe.js
benchmark/net/tcp-raw-s2c.js
benchmark/path/basename.js
benchmark/path/dirname.js
benchmark/path/extname.js
benchmark/path/format.js
benchmark/path/isAbsolute.js
benchmark/path/join.js
benchmark/path/normalize.js
benchmark/path/parse.js
benchmark/path/resolve.js
benchmark/querystring/querystring-parse.js
benchmark/querystring/querystring-stringify.js
benchmark/report-startup-memory.js
benchmark/static_http_server.js
benchmark/tls/throughput.js
benchmark/url/url-parse.js
benchmark/url/url-resolve.js
benchmark/util/inspect.js

index 2b5fefc..74a73c9 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var bench = common.createBenchmark(main, {
   type: ['Array', 'Buffer', 'Int8Array', 'Uint8Array', 'Int16Array',
index 015e9a0..e2569ee 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var bench = common.createBenchmark(main, {
   type: ['Array', 'Buffer', 'Int8Array', 'Uint8Array', 'Int16Array',
index 4dad3e9..8be70c1 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var bench = common.createBenchmark(main, {
   type: ['Array', 'Buffer', 'Int8Array', 'Uint8Array', 'Int16Array',
index 23ab924..36094f6 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 const assert = require('assert');
 const common = require('../common.js');
 
index 630995a..8e2eec3 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 
 var bench = common.createBenchmark(main, {});
index 42795d0..50f420f 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common');
 
 var bench = common.createBenchmark(main, {
index b02e8a7..c83bb67 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 
 var bench = common.createBenchmark(main, {
index fc498d0..dfb6846 100644 (file)
@@ -1,4 +1,5 @@
-SlowBuffer = require('buffer').SlowBuffer;
+'use strict';
+const SlowBuffer = require('buffer').SlowBuffer;
 
 var common = require('../common.js');
 var bench = common.createBenchmark(main, {
index 0f54930..6f10033 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var fs = require('fs');
 const path = require('path');
index 77a0b59..fb8abc1 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var SlowBuffer = require('buffer').SlowBuffer;
 var common = require('../common.js');
 var assert = require('assert');
index ba289e1..2810aa1 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 
 var bench = common.createBenchmark(main, {
index f632fa6..70cf3a7 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var SlowBuffer = require('buffer').SlowBuffer;
 
index b84bcf2..4e07fc5 100644 (file)
@@ -1,4 +1,4 @@
-
+'use strict';
 var common = require('../common.js');
 var bench = common.createBenchmark(main, {
   noAssert: [false, true],
index ce0064e..ab9c1d1 100644 (file)
@@ -1,4 +1,4 @@
-
+'use strict';
 var common = require('../common.js');
 var bench = common.createBenchmark(main, {
   type: ['Uint8', 'Uint16LE', 'Uint16BE',
index c4f7e3b..eb1959b 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var assert = require('assert');
 var fs = require('fs');
 var path = require('path');
index 0855c62..44854ae 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var usage = 'node benchmark/compare.js ' +
             '<node-binary1> <node-binary2> ' +
             '[--html] [--red|-r] [--green|-g] ' +
index 450d798..fc379b2 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var crypto = require('crypto');
 var keylen = {'aes-128-gcm': 16, 'aes-192-gcm': 24, 'aes-256-gcm': 32};
index 594b51a..5da6f24 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 
 var bench = common.createBenchmark(main, {
index e7308db..4bcd37f 100644 (file)
@@ -1,5 +1,6 @@
 // throughput benchmark
 // creates a single hasher, then pushes a bunch of data through it
+'use strict';
 var common = require('../common.js');
 var crypto = require('crypto');
 
index bc64b1d..050bbeb 100644 (file)
@@ -1,5 +1,6 @@
 // throughput benchmark
 // creates a single hasher, then pushes a bunch of data through it
+'use strict';
 var common = require('../common.js');
 var crypto = require('crypto');
 
index 6bba234..cf05791 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 // throughput benchmark in signing and verifying
 var common = require('../common.js');
 var crypto = require('crypto');
index f2a6c9e..779cc8b 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 // throughput benchmark in signing and verifying
 var common = require('../common.js');
 var crypto = require('crypto');
index b6dacb1..99d8536 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var events = require('events');
 
index 0d84e58..b423c21 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var EventEmitter = require('events').EventEmitter;
 
index 4c45bd9..8777222 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var EventEmitter = require('events').EventEmitter;
 
index e7fda58..dfe7e27 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var EventEmitter = require('events').EventEmitter;
 
index a88cc14..063732e 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var EventEmitter = require('events').EventEmitter;
 
index c24e95a..e91ca50 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var EventEmitter = require('events').EventEmitter;
 
index 3e968e6..4c767cf 100644 (file)
@@ -1,5 +1,5 @@
-
 // If there are no args, then this is the root.  Run all the benchmarks!
+'use strict';
 if (!process.argv[2])
   parent();
 else
index e7adf87..c305485 100644 (file)
@@ -1,4 +1,5 @@
 // test the throughput of the fs.WriteStream class.
+'use strict';
 
 var path = require('path');
 var common = require('../common.js');
index ac32419..0f39f64 100644 (file)
@@ -1,6 +1,7 @@
 // Call fs.readFile over and over again really fast.
 // Then see how many times it got called.
 // Yes, this is a silly benchmark.  Most benchmarks are silly.
+'use strict';
 
 var path = require('path');
 var common = require('../common.js');
index 10508a0..4f41d2b 100644 (file)
@@ -1,4 +1,5 @@
 // test the throughput of the fs.WriteStream class.
+'use strict';
 
 var path = require('path');
 var common = require('../common.js');
index 62a74db..642f296 100644 (file)
@@ -6,6 +6,7 @@
 // always as hot as it could be.
 //
 // Verify that our assumptions are valid.
+'use strict';
 
 var common = require('../common.js');
 
@@ -16,7 +17,7 @@ var bench = common.createBenchmark(main, {
 });
 
 function main(conf) {
-  http = require('http');
+  const http = require('http');
   var chunk = new Buffer(conf.size);
   chunk.fill('8');
 
index 1c27dea..befa381 100644 (file)
@@ -1,4 +1,5 @@
 // Measure the time it takes for the HTTP client to send a request body.
+'use strict';
 
 var common = require('../common.js');
 var http = require('http');
index 6391704..9934883 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var PORT = common.PORT;
 
index cec721a..4e12e54 100644 (file)
@@ -6,6 +6,7 @@
 // always as hot as it could be.
 //
 // Verify that our assumptions are valid.
+'use strict';
 
 var common = require('../common.js');
 
@@ -17,7 +18,7 @@ var bench = common.createBenchmark(main, {
 });
 
 function main(conf) {
-  http = require('http');
+  const http = require('http');
   var chunk;
   var len = conf.kb * 1024;
   switch (conf.type) {
@@ -26,7 +27,6 @@ function main(conf) {
       chunk.fill('x');
       break;
     case 'utf':
-      encoding = 'utf8';
       chunk = new Array(len / 2 + 1).join('ü');
       break;
     case 'asc':
index ad7352d..5449c49 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var PORT = common.PORT;
 
index 6b7cbd0..354993a 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var spawn = require('child_process').spawn;
 var cluster = require('cluster');
 var http = require('http');
index 78d04fe..a3c1862 100644 (file)
@@ -1,3 +1,5 @@
+'use strict';
+
 var http = require('http');
 var port = parseInt(process.env.PORT, 10) || 8000;
 var defaultLag = parseInt(process.argv[2], 10) || 100;
index 2eb617a..6f56879 100644 (file)
@@ -6,6 +6,7 @@
 //   <args>   Arguments to pass to `ab`.
 //   <target> Target to benchmark, e.g. `bytes/1024` or `buffer/8192`.
 //
+'use strict';
 
 var http = require('http');
 var spawn = require('child_process').spawn;
index aca2090..d294e68 100644 (file)
@@ -1,4 +1,5 @@
-net = require('net');
+'use strict';
+const net = require('net');
 
 var errors = 0, connections = 0;
 
index 894dd55..c1a7474 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var bench = common.createBenchmark(main, {
   len: [64, 256, 1024, 4096, 32768],
index ed9b30a..6f1adca 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var domain = require('domain');
 
@@ -12,14 +13,13 @@ var gargs = [1, 2, 3];
 function main(conf) {
 
   var args, ret, n = +conf.n;
-  var arguments = gargs.slice(0, conf.arguments);
-
+  var myArguments = gargs.slice(0, conf.arguments);
   bench.start();
 
   bdomain.enter();
   for (var i = 0; i < n; i++) {
-    if (arguments.length >= 2) {
-      args = Array.prototype.slice.call(arguments, 1);
+    if (myArguments.length >= 2) {
+      args = Array.prototype.slice.call(myArguments, 1);
       ret = fn.apply(this, args);
     } else {
       fn.call(this);
index e722a21..04f5627 100644 (file)
@@ -2,6 +2,7 @@
 // relative to a comparable C++ function.
 // Reports millions of calls per second.
 // Note that JS speed goes up, while cxx speed stays about the same.
+'use strict';
 
 var assert = require('assert');
 var common = require('../../common.js');
index ad86891..1df7a74 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var fs = require('fs');
 var path = require('path');
 var common = require('../common.js');
index 6524081..87d130f 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 
 var common = require('../common.js');
 var bench = common.createBenchmark(main, {
index 8a2c8e0..bc513d3 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var bench = common.createBenchmark(main, {
   millions: [2]
index 2b1b989..7c9e851 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var bench = common.createBenchmark(main, {
   thousands: [1]
index 09cf88e..3460491 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var spawn = require('child_process').spawn;
 var path = require('path');
index b8683ed..59fb1b5 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 
 var common = require('../common.js');
 var bench = common.createBenchmark(main, {
index fe08c0e..b10b0a6 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var StringDecoder = require('string_decoder').StringDecoder;
 
index 23f571b..13b18ff 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 
 var bench = common.createBenchmark(main, {
index 6c2799b..78fe7b6 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var url = require('url')
 var n = 25 * 100;
 
index efe81f8..0b9a513 100644 (file)
@@ -1,4 +1,5 @@
 // compare with "google-chrome deps/v8/benchmarks/run.html"
+'use strict';
 var fs = require('fs');
 var path = require('path');
 var vm = require('vm');
index a811c86..5d1c8a7 100644 (file)
@@ -1,4 +1,5 @@
 // test the speed of .pipe() with sockets
+'use strict';
 
 var common = require('../common.js');
 var PORT = common.PORT;
index 718d440..370ff4f 100644 (file)
@@ -1,4 +1,5 @@
 // test the speed of .pipe() with sockets
+'use strict';
 
 var common = require('../common.js');
 var PORT = common.PORT;
index 63a0a26..ea8af24 100644 (file)
@@ -1,4 +1,5 @@
 // test the speed of .pipe() with sockets
+'use strict';
 
 var common = require('../common.js');
 var PORT = common.PORT;
index c4ab05a..af40d8d 100644 (file)
@@ -1,4 +1,5 @@
 // test the speed of .pipe() with sockets
+'use strict';
 
 var common = require('../common.js');
 var PORT = common.PORT;
index e3fc9ed..e13af85 100644 (file)
@@ -1,5 +1,6 @@
 // In this benchmark, we connect a client to the server, and write
 // as many bytes as we can in the specified time (default = 10s)
+'use strict';
 
 var common = require('../common.js');
 var util = require('util');
index 69fbac6..c05c816 100644 (file)
@@ -1,5 +1,6 @@
 // In this benchmark, we connect a client to the server, and write
 // as many bytes as we can in the specified time (default = 10s)
+'use strict';
 
 var common = require('../common.js');
 var util = require('util');
index 34f67bf..822a74c 100644 (file)
@@ -1,5 +1,6 @@
 // In this benchmark, we connect a client to the server, and write
 // as many bytes as we can in the specified time (default = 10s)
+'use strict';
 
 var common = require('../common.js');
 var util = require('util');
index 57d9492..6c710db 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var path = require('path');
 var v8 = require('v8');
index e95adf2..4a9c041 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var path = require('path');
 var v8 = require('v8');
index c655ee7..4f7c6b5 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var path = require('path');
 var v8 = require('v8');
index bc77f88..478a30c 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var path = require('path');
 var v8 = require('v8');
index d4c79b9..0d412f9 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var path = require('path');
 var v8 = require('v8');
index 58f4dc3..0262e25 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var path = require('path');
 var v8 = require('v8');
index 6f7f05e..56a637f 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var path = require('path');
 var v8 = require('v8');
index f3fbb2a..2afc143 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var path = require('path');
 var v8 = require('v8');
index 375e8b1..5235b94 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var path = require('path');
 var v8 = require('v8');
index 4fbc18b..1019a94 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var querystring = require('querystring');
 var v8 = require('v8');
index d4bb95c..c2f3855 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var querystring = require('querystring');
 var v8 = require('v8');
index 14e5623..6d79630 100644 (file)
@@ -1 +1,2 @@
+'use strict';
 console.log(process.memoryUsage().rss);
index 1a88fb5..804f83c 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var http = require('http');
 
 var concurrency = 30;
index 5877856..7b54526 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var bench = common.createBenchmark(main, {
   dur: [5],
index ffa47c4..8967954 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var url = require('url');
 var v8 = require('v8');
index 5f6c1f7..18f67e8 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var common = require('../common.js');
 var url = require('url');
 var v8 = require('v8');
index 9955bc6..3312bd6 100644 (file)
@@ -1,3 +1,4 @@
+'use strict';
 var util = require('util');
 
 var common = require('../common.js');