Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
benchmark: use strict mode
Apply strict mode to benchmark code.
  • Loading branch information
Trott committed Mar 17, 2016
commit 44c04604c3c962efac251a8079557e5701820a80
1 change: 1 addition & 0 deletions benchmark/arrays/var-int.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var bench = common.createBenchmark(main, {
type: ['Array', 'Buffer', 'Int8Array', 'Uint8Array', 'Int16Array',
Expand Down
1 change: 1 addition & 0 deletions benchmark/arrays/zero-float.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var bench = common.createBenchmark(main, {
type: ['Array', 'Buffer', 'Int8Array', 'Uint8Array', 'Int16Array',
Expand Down
1 change: 1 addition & 0 deletions benchmark/arrays/zero-int.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var bench = common.createBenchmark(main, {
type: ['Array', 'Buffer', 'Int8Array', 'Uint8Array', 'Int16Array',
Expand Down
1 change: 1 addition & 0 deletions benchmark/buffers/buffer-base64-decode.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
const assert = require('assert');
const common = require('../common.js');

Expand Down
1 change: 1 addition & 0 deletions benchmark/buffers/buffer-base64-encode.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');

var bench = common.createBenchmark(main, {});
Expand Down
1 change: 1 addition & 0 deletions benchmark/buffers/buffer-bytelength.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common');

var bench = common.createBenchmark(main, {
Expand Down
1 change: 1 addition & 0 deletions benchmark/buffers/buffer-compare.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');

var bench = common.createBenchmark(main, {
Expand Down
3 changes: 2 additions & 1 deletion benchmark/buffers/buffer-creation.js
Original file line number Diff line number Diff line change
@@ -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, {
Expand Down
1 change: 1 addition & 0 deletions benchmark/buffers/buffer-indexof.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var fs = require('fs');
const path = require('path');
Expand Down
1 change: 1 addition & 0 deletions benchmark/buffers/buffer-iterate.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var SlowBuffer = require('buffer').SlowBuffer;
var common = require('../common.js');
var assert = require('assert');
Expand Down
1 change: 1 addition & 0 deletions benchmark/buffers/buffer-read.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');

var bench = common.createBenchmark(main, {
Expand Down
1 change: 1 addition & 0 deletions benchmark/buffers/buffer-slice.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var SlowBuffer = require('buffer').SlowBuffer;

Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-write.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

'use strict';
var common = require('../common.js');
var bench = common.createBenchmark(main, {
noAssert: [false, true],
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/dataview-set.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

'use strict';
var common = require('../common.js');
var bench = common.createBenchmark(main, {
type: ['Uint8', 'Uint16LE', 'Uint16BE',
Expand Down
1 change: 1 addition & 0 deletions benchmark/common.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var assert = require('assert');
var fs = require('fs');
var path = require('path');
Expand Down
1 change: 1 addition & 0 deletions benchmark/compare.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var usage = 'node benchmark/compare.js ' +
'<node-binary1> <node-binary2> ' +
'[--html] [--red|-r] [--green|-g] ' +
Expand Down
1 change: 1 addition & 0 deletions benchmark/crypto/aes-gcm-throughput.js
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
1 change: 1 addition & 0 deletions benchmark/crypto/cipher-stream.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');

var bench = common.createBenchmark(main, {
Expand Down
1 change: 1 addition & 0 deletions benchmark/crypto/hash-stream-creation.js
Original file line number Diff line number Diff line change
@@ -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');

Expand Down
1 change: 1 addition & 0 deletions benchmark/crypto/hash-stream-throughput.js
Original file line number Diff line number Diff line change
@@ -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');

Expand Down
1 change: 1 addition & 0 deletions benchmark/crypto/rsa-encrypt-decrypt-throughput.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
// throughput benchmark in signing and verifying
var common = require('../common.js');
var crypto = require('crypto');
Expand Down
1 change: 1 addition & 0 deletions benchmark/crypto/rsa-sign-verify-throughput.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
// throughput benchmark in signing and verifying
var common = require('../common.js');
var crypto = require('crypto');
Expand Down
1 change: 1 addition & 0 deletions benchmark/events/ee-add-remove.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var events = require('events');

Expand Down
1 change: 1 addition & 0 deletions benchmark/events/ee-emit-multi-args.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var EventEmitter = require('events').EventEmitter;

Expand Down
1 change: 1 addition & 0 deletions benchmark/events/ee-emit.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var EventEmitter = require('events').EventEmitter;

Expand Down
1 change: 1 addition & 0 deletions benchmark/events/ee-listener-count-on-prototype.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var EventEmitter = require('events').EventEmitter;

Expand Down
1 change: 1 addition & 0 deletions benchmark/events/ee-listeners-many.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var EventEmitter = require('events').EventEmitter;

Expand Down
1 change: 1 addition & 0 deletions benchmark/events/ee-listeners.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var EventEmitter = require('events').EventEmitter;

Expand Down
2 changes: 1 addition & 1 deletion benchmark/fs-write-stream-throughput.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions benchmark/fs/read-stream-throughput.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// test the throughput of the fs.WriteStream class.
'use strict';

var path = require('path');
var common = require('../common.js');
Expand Down
1 change: 1 addition & 0 deletions benchmark/fs/readfile.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down
1 change: 1 addition & 0 deletions benchmark/fs/write-stream-throughput.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// test the throughput of the fs.WriteStream class.
'use strict';

var path = require('path');
var common = require('../common.js');
Expand Down
3 changes: 2 additions & 1 deletion benchmark/http/chunked.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// always as hot as it could be.
//
// Verify that our assumptions are valid.
'use strict';

var common = require('../common.js');

Expand All @@ -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');

Expand Down
1 change: 1 addition & 0 deletions benchmark/http/client-request-body.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down
1 change: 1 addition & 0 deletions benchmark/http/cluster.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var PORT = common.PORT;

Expand Down
4 changes: 2 additions & 2 deletions benchmark/http/end-vs-write-end.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// always as hot as it could be.
//
// Verify that our assumptions are valid.
'use strict';

var common = require('../common.js');

Expand All @@ -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) {
Expand All @@ -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':
Expand Down
1 change: 1 addition & 0 deletions benchmark/http/simple.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var PORT = common.PORT;

Expand Down
1 change: 1 addition & 0 deletions benchmark/http_bench.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var spawn = require('child_process').spawn;
var cluster = require('cluster');
var http = require('http');
Expand Down
2 changes: 2 additions & 0 deletions benchmark/http_server_lag.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
1 change: 1 addition & 0 deletions benchmark/http_simple_auto.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion benchmark/idle_clients.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
net = require('net');
'use strict';
const net = require('net');

var errors = 0, connections = 0;

Expand Down
1 change: 1 addition & 0 deletions benchmark/misc/child-process-read.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var bench = common.createBenchmark(main, {
len: [64, 256, 1024, 4096, 32768],
Expand Down
8 changes: 4 additions & 4 deletions benchmark/misc/domain-fn-args.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var domain = require('domain');

Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions benchmark/misc/function_call/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
1 change: 1 addition & 0 deletions benchmark/misc/module-loader.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var fs = require('fs');
var path = require('path');
var common = require('../common.js');
Expand Down
1 change: 1 addition & 0 deletions benchmark/misc/next-tick-breadth.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';

var common = require('../common.js');
var bench = common.createBenchmark(main, {
Expand Down
1 change: 1 addition & 0 deletions benchmark/misc/next-tick-depth.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var bench = common.createBenchmark(main, {
millions: [2]
Expand Down
1 change: 1 addition & 0 deletions benchmark/misc/spawn-echo.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var bench = common.createBenchmark(main, {
thousands: [1]
Expand Down
1 change: 1 addition & 0 deletions benchmark/misc/startup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var spawn = require('child_process').spawn;
var path = require('path');
Expand Down
1 change: 1 addition & 0 deletions benchmark/misc/string-creation.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';

var common = require('../common.js');
var bench = common.createBenchmark(main, {
Expand Down
1 change: 1 addition & 0 deletions benchmark/misc/string-decoder.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var StringDecoder = require('string_decoder').StringDecoder;

Expand Down
1 change: 1 addition & 0 deletions benchmark/misc/timers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');

var bench = common.createBenchmark(main, {
Expand Down
1 change: 1 addition & 0 deletions benchmark/misc/url.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var url = require('url')
var n = 25 * 100;

Expand Down
1 change: 1 addition & 0 deletions benchmark/misc/v8-bench.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/net-c2s-cork.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// test the speed of .pipe() with sockets
'use strict';

var common = require('../common.js');
var PORT = common.PORT;
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/net-c2s.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// test the speed of .pipe() with sockets
'use strict';

var common = require('../common.js');
var PORT = common.PORT;
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/net-pipe.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// test the speed of .pipe() with sockets
'use strict';

var common = require('../common.js');
var PORT = common.PORT;
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/net-s2c.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// test the speed of .pipe() with sockets
'use strict';

var common = require('../common.js');
var PORT = common.PORT;
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/tcp-raw-c2s.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/tcp-raw-pipe.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/tcp-raw-s2c.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down
1 change: 1 addition & 0 deletions benchmark/path/basename.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var common = require('../common.js');
var path = require('path');
var v8 = require('v8');
Expand Down
Loading