summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--benchmark/buffers/buffer-bytelength.js2
-rw-r--r--benchmark/buffers/buffer-read.js8
-rw-r--r--benchmark/buffers/buffer-write.js16
-rw-r--r--benchmark/common.js16
-rw-r--r--benchmark/crypto/aes-gcm-throughput.js2
-rw-r--r--benchmark/crypto/cipher-stream.js1
-rw-r--r--benchmark/crypto/hash-stream-creation.js3
-rw-r--r--benchmark/crypto/hash-stream-throughput.js3
-rw-r--r--benchmark/crypto/rsa-encrypt-decrypt-throughput.js3
-rw-r--r--benchmark/crypto/rsa-sign-verify-throughput.js4
-rw-r--r--benchmark/dgram/array-vs-concat.js3
-rw-r--r--benchmark/dgram/multi-buffer.js3
-rw-r--r--benchmark/dgram/offset-length.js1
-rw-r--r--benchmark/dgram/single-buffer.js1
-rw-r--r--benchmark/domain/domain-fn-args.js4
-rw-r--r--benchmark/events/ee-emit-multi-args.js1
-rw-r--r--benchmark/events/ee-listener-count-on-prototype.js2
-rw-r--r--benchmark/events/ee-listeners-many.js2
-rw-r--r--benchmark/events/ee-listeners.js2
-rw-r--r--benchmark/fs-write-stream-throughput.js5
-rw-r--r--benchmark/fs/read-stream-throughput.js2
-rw-r--r--benchmark/fs/write-stream-throughput.js2
-rw-r--r--benchmark/http/_chunky_http_client.js7
-rw-r--r--benchmark/http/chunked.js1
-rw-r--r--benchmark/http/end-vs-write-end.js1
-rw-r--r--benchmark/http/http_server_for_chunky_client.js12
-rw-r--r--benchmark/http/simple.js1
-rw-r--r--benchmark/http_bench.js10
-rw-r--r--benchmark/http_server_lag.js2
-rw-r--r--benchmark/http_simple.js18
-rw-r--r--benchmark/http_simple_auto.js59
-rw-r--r--benchmark/idle_clients.js18
-rw-r--r--benchmark/idle_server.js11
-rw-r--r--benchmark/misc/function_call/index.js2
-rw-r--r--benchmark/misc/startup.js4
-rw-r--r--benchmark/misc/string-creation.js4
-rw-r--r--benchmark/module/module-loader.js3
-rw-r--r--benchmark/net/net-c2s-cork.js7
-rw-r--r--benchmark/net/net-c2s.js1
-rw-r--r--benchmark/net/net-pipe.js1
-rw-r--r--benchmark/net/net-s2c.js1
-rw-r--r--benchmark/net/tcp-raw-c2s.js1
-rw-r--r--benchmark/net/tcp-raw-pipe.js1
-rw-r--r--benchmark/net/tcp-raw-s2c.js1
-rw-r--r--benchmark/path/basename-win32.js2
-rw-r--r--benchmark/static_http_server.js4
-rw-r--r--benchmark/tls/throughput.js3
-rw-r--r--benchmark/tls/tls-connect.js15
-rw-r--r--benchmark/util/inspect.js2
49 files changed, 118 insertions, 160 deletions
diff --git a/benchmark/buffers/buffer-bytelength.js b/benchmark/buffers/buffer-bytelength.js
index c40c7897a2..50f420f412 100644
--- a/benchmark/buffers/buffer-bytelength.js
+++ b/benchmark/buffers/buffer-bytelength.js
@@ -44,7 +44,7 @@ function main(conf) {
var r = Buffer.byteLength(strings[index], encoding);
if (r !== results[index])
- throw Error('incorrect return value');
+ throw new Error('incorrect return value');
}
bench.end(n);
}
diff --git a/benchmark/buffers/buffer-read.js b/benchmark/buffers/buffer-read.js
index 47affeee79..1cdc4bc469 100644
--- a/benchmark/buffers/buffer-read.js
+++ b/benchmark/buffers/buffer-read.js
@@ -22,10 +22,10 @@ function main(conf) {
buff.writeDoubleLE(0, 0, noAssert);
var testFunction = new Function('buff', [
- "for (var i = 0; i !== " + len + "; i++) {",
- " buff." + fn + "(0, " + JSON.stringify(noAssert) + ");",
- "}"
- ].join("\n"));
+ 'for (var i = 0; i !== ' + len + '; i++) {',
+ ' buff.' + fn + '(0, ' + JSON.stringify(noAssert) + ');',
+ '}'
+ ].join('\n'));
bench.start();
testFunction(buff);
bench.end(len / 1e6);
diff --git a/benchmark/buffers/buffer-write.js b/benchmark/buffers/buffer-write.js
index 657cebfacb..51f8cd505e 100644
--- a/benchmark/buffers/buffer-write.js
+++ b/benchmark/buffers/buffer-write.js
@@ -48,10 +48,10 @@ function main(conf) {
function benchInt(buff, fn, len, noAssert) {
var m = mod[fn];
var testFunction = new Function('buff', [
- "for (var i = 0; i !== " + len + "; i++) {",
- " buff." + fn + "(i & " + m + ", 0, " + JSON.stringify(noAssert) + ");",
- "}"
- ].join("\n"));
+ 'for (var i = 0; i !== ' + len + '; i++) {',
+ ' buff.' + fn + '(i & ' + m + ', 0, ' + JSON.stringify(noAssert) + ');',
+ '}'
+ ].join('\n'));
bench.start();
testFunction(buff);
bench.end(len / 1e6);
@@ -59,10 +59,10 @@ function benchInt(buff, fn, len, noAssert) {
function benchFloat(buff, fn, len, noAssert) {
var testFunction = new Function('buff', [
- "for (var i = 0; i !== " + len + "; i++) {",
- " buff." + fn + "(i, 0, " + JSON.stringify(noAssert) + ");",
- "}"
- ].join("\n"));
+ 'for (var i = 0; i !== ' + len + '; i++) {',
+ ' buff.' + fn + '(i, 0, ' + JSON.stringify(noAssert) + ');',
+ '}'
+ ].join('\n'));
bench.start();
testFunction(buff);
bench.end(len / 1e6);
diff --git a/benchmark/common.js b/benchmark/common.js
index 1ff4b50f8a..d1bc985f09 100644
--- a/benchmark/common.js
+++ b/benchmark/common.js
@@ -28,7 +28,7 @@ if (module === require.main) {
var tests = fs.readdirSync(dir);
if (testFilter) {
- var filteredTests = tests.filter(function(item){
+ var filteredTests = tests.filter(function(item) {
if (item.lastIndexOf(testFilter) >= 0) {
return item;
}
@@ -49,7 +49,7 @@ function hasWrk() {
if (result.error && result.error.code === 'ENOENT') {
console.error('Couldn\'t locate `wrk` which is needed for running ' +
'benchmarks. Check benchmark/README.md for further instructions.');
- process.exit(-1);
+ process.exit(-1);
}
}
@@ -87,7 +87,7 @@ function Benchmark(fn, options) {
this.options = options;
this.config = parseOpts(options);
this._name = require.main.filename.split(/benchmark[\/\\]/).pop();
- this._start = [0,0];
+ this._start = [0, 0];
this._started = false;
var self = this;
@@ -121,7 +121,7 @@ Benchmark.prototype.http = function(p, args, cb) {
if (code) {
console.error('wrk failed with ' + code);
- process.exit(code)
+ process.exit(code);
}
var match = out.match(regexp);
var qps = match && +match[1];
@@ -141,8 +141,6 @@ Benchmark.prototype._run = function() {
// some options weren't set.
// run with all combinations
var main = require.main.filename;
- var settings = [];
- var queueLen = 1;
var options = this.options;
var queue = Object.keys(options).reduce(function(set, key) {
@@ -210,7 +208,7 @@ function parseOpts(options) {
});
}
return num === 0 ? conf : null;
-};
+}
Benchmark.prototype.start = function() {
if (this._started)
@@ -228,8 +226,8 @@ Benchmark.prototype.end = function(operations) {
if (typeof operations !== 'number')
throw new Error('called end() without specifying operation count');
- var time = elapsed[0] + elapsed[1]/1e9;
- var rate = operations/time;
+ var time = elapsed[0] + elapsed[1] / 1e9;
+ var rate = operations / time;
this.report(rate);
};
diff --git a/benchmark/crypto/aes-gcm-throughput.js b/benchmark/crypto/aes-gcm-throughput.js
index 8d4eba54cd..fc379b21b7 100644
--- a/benchmark/crypto/aes-gcm-throughput.js
+++ b/benchmark/crypto/aes-gcm-throughput.js
@@ -31,7 +31,7 @@ function AEAD_Bench(cipher, message, associate_data, key, iv, n, len) {
var bob = crypto.createDecipheriv(cipher, key, iv);
bob.setAuthTag(tag);
bob.setAAD(associate_data);
- var clear = bob.update(enc);
+ bob.update(enc);
bob.final();
}
diff --git a/benchmark/crypto/cipher-stream.js b/benchmark/crypto/cipher-stream.js
index df1ae8d696..affed1b462 100644
--- a/benchmark/crypto/cipher-stream.js
+++ b/benchmark/crypto/cipher-stream.js
@@ -96,7 +96,6 @@ function legacyWrite(alice, bob, message, encoding, writes) {
written += dec.length;
dec = bob.final();
written += dec.length;
- var bits = written * 8;
var gbits = written / (1024 * 1024 * 1024);
bench.end(gbits);
}
diff --git a/benchmark/crypto/hash-stream-creation.js b/benchmark/crypto/hash-stream-creation.js
index 31b6706c02..4bcd37f00a 100644
--- a/benchmark/crypto/hash-stream-creation.js
+++ b/benchmark/crypto/hash-stream-creation.js
@@ -21,9 +21,6 @@ function main(conf) {
api = 'legacy';
}
- var crypto = require('crypto');
- var assert = require('assert');
-
var message;
var encoding;
switch (conf.type) {
diff --git a/benchmark/crypto/hash-stream-throughput.js b/benchmark/crypto/hash-stream-throughput.js
index 2a17ce576c..050bbeb1ae 100644
--- a/benchmark/crypto/hash-stream-throughput.js
+++ b/benchmark/crypto/hash-stream-throughput.js
@@ -20,9 +20,6 @@ function main(conf) {
api = 'legacy';
}
- var crypto = require('crypto');
- var assert = require('assert');
-
var message;
var encoding;
switch (conf.type) {
diff --git a/benchmark/crypto/rsa-encrypt-decrypt-throughput.js b/benchmark/crypto/rsa-encrypt-decrypt-throughput.js
index 86d3de4600..cf0579134c 100644
--- a/benchmark/crypto/rsa-encrypt-decrypt-throughput.js
+++ b/benchmark/crypto/rsa-encrypt-decrypt-throughput.js
@@ -23,7 +23,6 @@ var bench = common.createBenchmark(main, {
});
function main(conf) {
- var crypto = require('crypto');
var message = (new Buffer(conf.len)).fill('b');
bench.start();
@@ -39,7 +38,7 @@ function StreamWrite(algo, keylen, message, n, len) {
var publicKey = RSA_PublicPem[keylen];
for (var i = 0; i < n; i++) {
var enc = crypto.privateEncrypt(privateKey, message);
- var clear = crypto.publicDecrypt(publicKey, enc);
+ crypto.publicDecrypt(publicKey, enc);
}
bench.end(kbits);
diff --git a/benchmark/crypto/rsa-sign-verify-throughput.js b/benchmark/crypto/rsa-sign-verify-throughput.js
index 200e573294..779cc8bca1 100644
--- a/benchmark/crypto/rsa-sign-verify-throughput.js
+++ b/benchmark/crypto/rsa-sign-verify-throughput.js
@@ -24,7 +24,6 @@ var bench = common.createBenchmark(main, {
});
function main(conf) {
- var crypto = require('crypto');
var message = (new Buffer(conf.len)).fill('b');
bench.start();
@@ -37,7 +36,6 @@ function StreamWrite(algo, keylen, message, writes, len) {
var kbits = bits / (1024);
var privateKey = RSA_PrivatePem[keylen];
- var publicKey = RSA_PublicPem[keylen];
var s = crypto.createSign(algo);
var v = crypto.createVerify(algo);
@@ -46,7 +44,7 @@ function StreamWrite(algo, keylen, message, writes, len) {
v.update(message);
}
- var sign = s.sign(privateKey, 'binary');
+ s.sign(privateKey, 'binary');
s.end();
v.end();
diff --git a/benchmark/dgram/array-vs-concat.js b/benchmark/dgram/array-vs-concat.js
index 0be7c70e08..ee74ff66b9 100644
--- a/benchmark/dgram/array-vs-concat.js
+++ b/benchmark/dgram/array-vs-concat.js
@@ -21,7 +21,6 @@ var num;
var type;
var chunk;
var chunks;
-var encoding;
function main(conf) {
dur = +conf.dur;
@@ -30,7 +29,7 @@ function main(conf) {
type = conf.type;
chunks = +conf.chunks;
- chunk = []
+ chunk = [];
for (var i = 0; i < chunks; i++) {
chunk.push(new Buffer(Math.round(len / chunks)));
}
diff --git a/benchmark/dgram/multi-buffer.js b/benchmark/dgram/multi-buffer.js
index 37fb5d1a8e..22c3059419 100644
--- a/benchmark/dgram/multi-buffer.js
+++ b/benchmark/dgram/multi-buffer.js
@@ -21,7 +21,6 @@ var num;
var type;
var chunk;
var chunks;
-var encoding;
function main(conf) {
dur = +conf.dur;
@@ -30,7 +29,7 @@ function main(conf) {
type = conf.type;
chunks = +conf.chunks;
- chunk = []
+ chunk = [];
for (var i = 0; i < chunks; i++) {
chunk.push(new Buffer(Math.round(len / chunks)));
}
diff --git a/benchmark/dgram/offset-length.js b/benchmark/dgram/offset-length.js
index 4c3b11b58e..c11c465f5c 100644
--- a/benchmark/dgram/offset-length.js
+++ b/benchmark/dgram/offset-length.js
@@ -19,7 +19,6 @@ var len;
var num;
var type;
var chunk;
-var encoding;
function main(conf) {
dur = +conf.dur;
diff --git a/benchmark/dgram/single-buffer.js b/benchmark/dgram/single-buffer.js
index d44ea4fd83..765311a72f 100644
--- a/benchmark/dgram/single-buffer.js
+++ b/benchmark/dgram/single-buffer.js
@@ -19,7 +19,6 @@ var len;
var num;
var type;
var chunk;
-var encoding;
function main(conf) {
dur = +conf.dur;
diff --git a/benchmark/domain/domain-fn-args.js b/benchmark/domain/domain-fn-args.js
index 517ca924e9..321334dbf1 100644
--- a/benchmark/domain/domain-fn-args.js
+++ b/benchmark/domain/domain-fn-args.js
@@ -12,7 +12,7 @@ var gargs = [1, 2, 3];
function main(conf) {
- var args, ret, n = +conf.n;
+ var args, n = +conf.n;
var myArguments = gargs.slice(0, conf.arguments);
bench.start();
@@ -41,4 +41,4 @@ function fn(a, b, c) {
c = 3;
return a + b + c;
-} \ No newline at end of file
+}
diff --git a/benchmark/events/ee-emit-multi-args.js b/benchmark/events/ee-emit-multi-args.js
index 7416915db1..b423c216b1 100644
--- a/benchmark/events/ee-emit-multi-args.js
+++ b/benchmark/events/ee-emit-multi-args.js
@@ -8,7 +8,6 @@ function main(conf) {
var n = conf.n | 0;
var ee = new EventEmitter();
- var listeners = [];
for (var k = 0; k < 10; k += 1)
ee.on('dummy', function() {});
diff --git a/benchmark/events/ee-listener-count-on-prototype.js b/benchmark/events/ee-listener-count-on-prototype.js
index 9fb060a6a1..dfe7e27cd0 100644
--- a/benchmark/events/ee-listener-count-on-prototype.js
+++ b/benchmark/events/ee-listener-count-on-prototype.js
@@ -14,7 +14,7 @@ function main(conf) {
bench.start();
for (var i = 0; i < n; i += 1) {
- var r = ee.listenerCount('dummy');
+ ee.listenerCount('dummy');
}
bench.end(n);
}
diff --git a/benchmark/events/ee-listeners-many.js b/benchmark/events/ee-listeners-many.js
index 6ea838286c..063732e1fa 100644
--- a/benchmark/events/ee-listeners-many.js
+++ b/benchmark/events/ee-listeners-many.js
@@ -15,7 +15,7 @@ function main(conf) {
bench.start();
for (var i = 0; i < n; i += 1) {
- var r = ee.listeners('dummy');
+ ee.listeners('dummy');
}
bench.end(n);
}
diff --git a/benchmark/events/ee-listeners.js b/benchmark/events/ee-listeners.js
index 05b400662c..e91ca5078f 100644
--- a/benchmark/events/ee-listeners.js
+++ b/benchmark/events/ee-listeners.js
@@ -14,7 +14,7 @@ function main(conf) {
bench.start();
for (var i = 0; i < n; i += 1) {
- var r = ee.listeners('dummy');
+ ee.listeners('dummy');
}
bench.end(n);
}
diff --git a/benchmark/fs-write-stream-throughput.js b/benchmark/fs-write-stream-throughput.js
index a251af526a..197853a1fc 100644
--- a/benchmark/fs-write-stream-throughput.js
+++ b/benchmark/fs-write-stream-throughput.js
@@ -49,14 +49,13 @@ function runTest(dur, size, type) {
break;
}
- var writes = 0;
var fs = require('fs');
try { fs.unlinkSync('write_stream_throughput'); } catch (e) {}
- var start
+ var start;
var end;
function done() {
- var time = end[0] + end[1]/1E9;
+ var time = end[0] + end[1] / 1E9;
var written = fs.statSync('write_stream_throughput').size / 1024;
var rate = (written / time).toFixed(2);
console.log('fs_write_stream_dur_%d_size_%d_type_%s: %d',
diff --git a/benchmark/fs/read-stream-throughput.js b/benchmark/fs/read-stream-throughput.js
index 6b6a392796..c305485cd5 100644
--- a/benchmark/fs/read-stream-throughput.js
+++ b/benchmark/fs/read-stream-throughput.js
@@ -12,7 +12,7 @@ var type, encoding, size;
var bench = common.createBenchmark(main, {
type: ['buf', 'asc', 'utf'],
- size: [1024, 4096, 65535, 1024*1024]
+ size: [1024, 4096, 65535, 1024 * 1024]
});
function main(conf) {
diff --git a/benchmark/fs/write-stream-throughput.js b/benchmark/fs/write-stream-throughput.js
index a3eef67aa4..4f41d2b4bb 100644
--- a/benchmark/fs/write-stream-throughput.js
+++ b/benchmark/fs/write-stream-throughput.js
@@ -29,7 +29,7 @@ function main(conf) {
encoding = 'ascii';
break;
case 'utf':
- chunk = new Array(Math.ceil(size/2) + 1).join('ü');
+ chunk = new Array(Math.ceil(size / 2) + 1).join('ü');
encoding = 'utf8';
break;
default:
diff --git a/benchmark/http/_chunky_http_client.js b/benchmark/http/_chunky_http_client.js
index 24e14ca2bc..158be5a0eb 100644
--- a/benchmark/http/_chunky_http_client.js
+++ b/benchmark/http/_chunky_http_client.js
@@ -15,7 +15,6 @@ var bench = common.createBenchmark(main, {
function main(conf) {
var len = +conf.len;
var num = +conf.num;
- var type = conf.type;
var todo = [];
var headers = [];
// Chose 7 because 9 showed "Connection error" / "Connection closed"
@@ -24,7 +23,7 @@ function main(conf) {
headers.push(Array(i + 1).join('o'));
function WriteHTTPHeaders(channel, has_keep_alive, extra_header_count) {
- todo = []
+ todo = [];
todo.push('GET / HTTP/1.1');
todo.push('Host: localhost');
todo.push('Connection: keep-alive');
@@ -63,7 +62,7 @@ function main(conf) {
var socket = net.connect(PIPE, function() {
bench.start();
WriteHTTPHeaders(socket, 1, len);
- socket.setEncoding('utf8')
+ socket.setEncoding('utf8');
socket.on('data', function(d) {
var did = false;
var pattern = 'HTTP/1.1 200 OK\r\n';
@@ -73,7 +72,7 @@ function main(conf) {
success += 1;
did = true;
} else {
- pattern = 'HTTP/1.1 '
+ pattern = 'HTTP/1.1 ';
if ((d.length === pattern.length && d === pattern) ||
(d.length > pattern.length &&
d.slice(0, pattern.length) === pattern)) {
diff --git a/benchmark/http/chunked.js b/benchmark/http/chunked.js
index 9743bc1d6f..642f2962cd 100644
--- a/benchmark/http/chunked.js
+++ b/benchmark/http/chunked.js
@@ -9,7 +9,6 @@
'use strict';
var common = require('../common.js');
-var PORT = common.PORT;
var bench = common.createBenchmark(main, {
num: [1, 4, 8, 16],
diff --git a/benchmark/http/end-vs-write-end.js b/benchmark/http/end-vs-write-end.js
index d6b3ebe409..4e12e543f0 100644
--- a/benchmark/http/end-vs-write-end.js
+++ b/benchmark/http/end-vs-write-end.js
@@ -9,7 +9,6 @@
'use strict';
var common = require('../common.js');
-var PORT = common.PORT;
var bench = common.createBenchmark(main, {
type: ['asc', 'utf', 'buf'],
diff --git a/benchmark/http/http_server_for_chunky_client.js b/benchmark/http/http_server_for_chunky_client.js
index dede7daa7c..d85e15bcbe 100644
--- a/benchmark/http/http_server_for_chunky_client.js
+++ b/benchmark/http/http_server_for_chunky_client.js
@@ -4,8 +4,8 @@ var path = require('path');
var http = require('http');
var fs = require('fs');
var spawn = require('child_process').spawn;
-var common = require('../common.js')
-var test = require('../../test/common.js')
+require('../common.js');
+var test = require('../../test/common.js');
var pep = path.dirname(process.argv[1]) + '/_chunky_http_client.js';
var PIPE = test.PIPE;
@@ -38,17 +38,17 @@ try {
child = spawn(process.execPath, [pep], { });
child.on('error', function(err) {
- throw new Error('spawn error: ' + err );
+ throw new Error('spawn error: ' + err);
});
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
- child.on('close', function (exitCode) {
+ child.on('close', function(exitCode) {
server.close();
});
-} catch(e) {
- throw new Error('error: ' + e );
+} catch (e) {
+ throw new Error('error: ' + e);
}
diff --git a/benchmark/http/simple.js b/benchmark/http/simple.js
index 835fa3d52f..5449c49be9 100644
--- a/benchmark/http/simple.js
+++ b/benchmark/http/simple.js
@@ -12,7 +12,6 @@ var bench = common.createBenchmark(main, {
function main(conf) {
process.env.PORT = PORT;
- var spawn = require('child_process').spawn;
var server = require('../http_simple.js');
setTimeout(function() {
var path = '/' + conf.type + '/' + conf.length + '/' + conf.chunks;
diff --git a/benchmark/http_bench.js b/benchmark/http_bench.js
index 4d21415697..354993a270 100644
--- a/benchmark/http_bench.js
+++ b/benchmark/http_bench.js
@@ -21,10 +21,10 @@ for (var i = 2; i < process.argv.length; ++i) {
}
switch (options.mode) {
-case 'master': startMaster(); break;
-case 'server': startServer(); break;
-case 'client': startClient(); break;
-default: throw new Error('Bad mode: ' + options.mode);
+ case 'master': startMaster(); break;
+ case 'server': startServer(); break;
+ case 'client': startClient(); break;
+ default: throw new Error('Bad mode: ' + options.mode);
}
process.title = 'http_bench[' + options.mode + ']';
@@ -48,7 +48,7 @@ function startMaster() {
var forkCount = 0;
- cluster.on('online', function () {
+ cluster.on('online', function() {
forkCount = forkCount + 1;
if (forkCount === ~~options.servers) {
var args = [
diff --git a/benchmark/http_server_lag.js b/benchmark/http_server_lag.js
index bc1825b22c..a3c18628ec 100644
--- a/benchmark/http_server_lag.js
+++ b/benchmark/http_server_lag.js
@@ -8,7 +8,7 @@ http.createServer(function(req, res) {
res.writeHead(200, { 'content-type': 'text/plain',
'content-length': '2' });
- var lag = parseInt(req.url.split("/").pop(), 10) || defaultLag;
+ var lag = parseInt(req.url.split('/').pop(), 10) || defaultLag;
setTimeout(function() {
res.end('ok');
}, lag);
diff --git a/benchmark/http_simple.js b/benchmark/http_simple.js
index df0505b07a..a0224f7960 100644
--- a/benchmark/http_simple.js
+++ b/benchmark/http_simple.js
@@ -1,15 +1,13 @@
'use strict';
-var path = require('path'),
- exec = require('child_process').exec,
- http = require('http');
+var http = require('http');
var port = parseInt(process.env.PORT || 8000);
var fixed = makeString(20 * 1024, 'C'),
- storedBytes = {},
- storedBuffer = {},
- storedUnicode = {};
+ storedBytes = {},
+ storedBuffer = {},
+ storedUnicode = {};
var useDomains = process.env.NODE_USE_DOMAINS;
@@ -24,7 +22,7 @@ if (useDomains) {
gdom.enter();
}
-var server = module.exports = http.createServer(function (req, res) {
+var server = module.exports = http.createServer(function(req, res) {
if (useDomains) {
var dom = domain.create();
dom.add(req);
@@ -41,7 +39,7 @@ var server = module.exports = http.createServer(function (req, res) {
if (command == 'bytes') {
var n = ~~arg;
if (n <= 0)
- throw new Error('bytes called with n <= 0')
+ throw new Error('bytes called with n <= 0');
if (storedBytes[n] === undefined) {
storedBytes[n] = makeString(n, 'C');
}
@@ -116,7 +114,7 @@ function makeString(size, c) {
return s;
}
-server.listen(port, function () {
+server.listen(port, function() {
if (module === require.main)
- console.error('Listening at http://127.0.0.1:'+port+'/');
+ console.error('Listening at http://127.0.0.1:' + port + '/');
});
diff --git a/benchmark/http_simple_auto.js b/benchmark/http_simple_auto.js
index 9d165939af..11ef6dc4f0 100644
--- a/benchmark/http_simple_auto.js
+++ b/benchmark/http_simple_auto.js
@@ -8,74 +8,73 @@
//
'use strict';
-var path = require("path");
-var http = require("http");
-var spawn = require("child_process").spawn;
+var http = require('http');
+var spawn = require('child_process').spawn;
var port = parseInt(process.env.PORT || 8000);
-var fixed = ""
-for (var i = 0; i < 20*1024; i++) {
- fixed += "C";
+var fixed = '';
+for (var i = 0; i < 20 * 1024; i++) {
+ fixed += 'C';
}
var stored = {};
var storedBuffer = {};
-var server = http.createServer(function (req, res) {
- var commands = req.url.split("/");
+var server = http.createServer(function(req, res) {
+ var commands = req.url.split('/');
var command = commands[1];
- var body = "";
+ var body = '';
var arg = commands[2];
var n_chunks = parseInt(commands[3], 10);
var status = 200;
- if (command == "bytes") {
- var n = parseInt(arg, 10)
+ if (command == 'bytes') {
+ var n = parseInt(arg, 10);
if (n <= 0)
- throw "bytes called with n <= 0"
+ throw new Error('bytes called with n <= 0');
if (stored[n] === undefined) {
- stored[n] = "";
+ stored[n] = '';
for (var i = 0; i < n; i++) {
- stored[n] += "C"
+ stored[n] += 'C';
}
}
body = stored[n];
- } else if (command == "buffer") {
- var n = parseInt(arg, 10)
- if (n <= 0) throw new Error("bytes called with n <= 0");
+ } else if (command == 'buffer') {
+ var n = parseInt(arg, 10);
+ if (n <= 0) throw new Error('bytes called with n <= 0');
if (storedBuffer[n] === undefined) {
storedBuffer[n] = new Buffer(n);
for (var i = 0; i < n; i++) {
- storedBuffer[n][i] = "C".charCodeAt(0);
+ storedBuffer[n][i] = 'C'.charCodeAt(0);
}
}
body = storedBuffer[n];
- } else if (command == "quit") {
+ } else if (command == 'quit') {
res.connection.server.close();
- body = "quitting";
+ body = 'quitting';
- } else if (command == "fixed") {
+ } else if (command == 'fixed') {
body = fixed;
- } else if (command == "echo") {
- res.writeHead(200, { "Content-Type": "text/plain",
- "Transfer-Encoding": "chunked" });
+ } else if (command == 'echo') {
+ res.writeHead(200, { 'Content-Type': 'text/plain',
+ 'Transfer-Encoding': 'chunked' });
req.pipe(res);
return;
} else {
status = 404;
- body = "not found\n";
+ body = 'not found\n';
}
// example: http://localhost:port/bytes/512/4
// sends a 512 byte body in 4 chunks of 128 bytes
if (n_chunks > 0) {
- res.writeHead(status, { "Content-Type": "text/plain",
- "Transfer-Encoding": "chunked" });
+ res.writeHead(status, { 'Content-Type': 'text/plain',
+ 'Transfer-Encoding': 'chunked' });
// send body in chunks
var len = body.length;
var step = Math.floor(len / n_chunks) || 1;
@@ -87,14 +86,14 @@ var server = http.createServer(function (req, res) {
} else {
var content_length = body.length.toString();
- res.writeHead(status, { "Content-Type": "text/plain",
- "Content-Length": content_length });
+ res.writeHead(status, { 'Content-Type': 'text/plain',
+ 'Content-Length': content_length });
res.end(body);
}
});
-server.listen(port, function () {
+server.listen(port, function() {
var url = 'http://127.0.0.1:' + port + '/';
var n = process.argv.length - 1;
diff --git a/benchmark/idle_clients.js b/benchmark/idle_clients.js
index 704ed2e986..9014d231d4 100644
--- a/benchmark/idle_clients.js
+++ b/benchmark/idle_clients.js
@@ -3,26 +3,24 @@ const net = require('net');
var errors = 0, connections = 0;
-var lastClose = 0;
-
-function connect () {
- process.nextTick(function () {
+function connect() {
+ process.nextTick(function() {
var s = net.Stream();
var gotConnected = false;
s.connect(9000);
- s.on('connect', function () {
+ s.on('connect', function() {
gotConnected = true;
connections++;
connect();
});
- s.on('close', function () {
+ s.on('close', function() {
if (gotConnected) connections--;
lastClose = new Date();
});
- s.on('error', function () {
+ s.on('error', function() {
errors++;
});
});
@@ -36,15 +34,15 @@ var oldConnections, oldErrors;
// Try to start new connections every so often
setInterval(connect, 5000);
-setInterval(function () {
+setInterval(function() {
if (oldConnections != connections) {
oldConnections = connections;
- console.log("CLIENT %d connections: %d", process.pid, connections);
+ console.log('CLIENT %d connections: %d', process.pid, connections);
}
if (oldErrors != errors) {
oldErrors = errors;
- console.log("CLIENT %d errors: %d", process.pid, errors);
+ console.log('CLIENT %d errors: %d', process.pid, errors);
}
}, 1000);
diff --git a/benchmark/idle_server.js b/benchmark/idle_server.js
index 805c988811..78e496690d 100644
--- a/benchmark/idle_server.js
+++ b/benchmark/idle_server.js
@@ -1,12 +1,11 @@
'use strict';
const net = require('net');
-var connections = 0;
var errors = 0;
-var server = net.Server(function (socket) {
+var server = net.Server(function(socket) {
- socket.on('error', function () {
+ socket.on('error', function() {
errors++;
});
@@ -18,14 +17,14 @@ server.listen(9000);
var oldConnections, oldErrors;
-setInterval(function () {
+setInterval(function() {
if (oldConnections != server.connections) {
oldConnections = server.connections;
- console.log("SERVER %d connections: %d", process.pid, server.connections);
+ console.log('SERVER %d connections: %d', process.pid, server.connections);
}
if (oldErrors != errors) {
oldErrors = errors;
- console.log("SERVER %d errors: %d", process.pid, errors);
+ console.log('SERVER %d errors: %d', process.pid, errors);
}
}, 1000);
diff --git a/benchmark/misc/function_call/index.js b/benchmark/misc/function_call/index.js
index e2e01b17fa..04f5627093 100644
--- a/benchmark/misc/function_call/index.js
+++ b/benchmark/misc/function_call/index.js
@@ -28,7 +28,7 @@ assert(js() === cxx());
var bench = common.createBenchmark(main, {
type: ['js', 'cxx'],
- millions: [1,10,50]
+ millions: [1, 10, 50]
});
function main(conf) {
diff --git a/benchmark/misc/startup.js b/benchmark/misc/startup.js
index f4577796b0..34604911d2 100644
--- a/benchmark/misc/startup.js
+++ b/benchmark/misc/startup.js
@@ -3,9 +3,6 @@ var common = require('../common.js');
var spawn = require('child_process').spawn;
var path = require('path');
var emptyJsFile = path.resolve(__dirname, '../../test/fixtures/semicolon.js');
-var starts = 100;
-var i = 0;
-var start;
var bench = common.createBenchmark(startNode, {
dur: [1]
@@ -15,7 +12,6 @@ function startNode(conf) {
var dur = +conf.dur;
var go = true;
var starts = 0;
- var open = 0;
setTimeout(function() {
go = false;
diff --git a/benchmark/misc/string-creation.js b/benchmark/misc/string-creation.js
index 74dea02312..59fb1b52b4 100644
--- a/benchmark/misc/string-creation.js
+++ b/benchmark/misc/string-creation.js
@@ -3,7 +3,7 @@
var common = require('../common.js');
var bench = common.createBenchmark(main, {
millions: [100]
-})
+});
function main(conf) {
var n = +conf.millions * 1e6;
@@ -11,7 +11,7 @@ function main(conf) {
var s;
for (var i = 0; i < n; i++) {
s = '01234567890';
- s[1] = "a";
+ s[1] = 'a';
}
bench.end(n / 1e6);
}
diff --git a/benchmark/module/module-loader.js b/benchmark/module/module-loader.js
index 17948604c7..8c31f36522 100644
--- a/benchmark/module/module-loader.js
+++ b/benchmark/module/module-loader.js
@@ -2,7 +2,6 @@
var fs = require('fs');
var path = require('path');
var common = require('../common.js');
-var packageJson = '{"main": "index.js"}';
var tmpDirectory = path.join(__dirname, '..', 'tmp');
var benchmarkDirectory = path.join(tmpDirectory, 'nodejs-benchmark-module');
@@ -39,7 +38,7 @@ function rmrf(location) {
var things = fs.readdirSync(location);
things.forEach(function(thing) {
var cur = path.join(location, thing),
- isDirectory = fs.statSync(cur).isDirectory();
+ isDirectory = fs.statSync(cur).isDirectory();
if (isDirectory) {
rmrf(cur);
return;
diff --git a/benchmark/net/net-c2s-cork.js b/benchmark/net/net-c2s-cork.js
index 4ca53716b7..5d1c8a7495 100644
--- a/benchmark/net/net-c2s-cork.js
+++ b/benchmark/net/net-c2s-cork.js
@@ -36,7 +36,6 @@ function main(conf) {
break;
default:
throw new Error('invalid type: ' + type);
- break;
}
server();
@@ -78,8 +77,8 @@ function server() {
socket.on('connect', function() {
bench.start();
- socket.on('drain', send)
- send()
+ socket.on('drain', send);
+ send();
setTimeout(function() {
var bytes = writer.received;
@@ -89,7 +88,7 @@ function server() {
function send() {
socket.cork();
- while(socket.write(chunk, encoding)) {}
+ while (socket.write(chunk, encoding)) {}
socket.uncork();
}
});
diff --git a/benchmark/net/net-c2s.js b/benchmark/net/net-c2s.js
index bbfbd883f8..370ff4f138 100644
--- a/benchmark/net/net-c2s.js
+++ b/benchmark/net/net-c2s.js
@@ -36,7 +36,6 @@ function main(conf) {
break;
default:
throw new Error('invalid type: ' + type);
- break;
}
server();
diff --git a/benchmark/net/net-pipe.js b/benchmark/net/net-pipe.js
index d12a45fc9c..ea8af249a3 100644
--- a/benchmark/net/net-pipe.js
+++ b/benchmark/net/net-pipe.js
@@ -36,7 +36,6 @@ function main(conf) {
break;
default:
throw new Error('invalid type: ' + type);
- break;
}
server();
diff --git a/benchmark/net/net-s2c.js b/benchmark/net/net-s2c.js
index 4dc8462108..af40d8d58d 100644
--- a/benchmark/net/net-s2c.js
+++ b/benchmark/net/net-s2c.js
@@ -36,7 +36,6 @@ function main(conf) {
break;
default:
throw new Error('invalid type: ' + type);
- break;
}
server();
diff --git a/benchmark/net/tcp-raw-c2s.js b/benchmark/net/tcp-raw-c2s.js
index 25efc78c0a..e13af85c67 100644
--- a/benchmark/net/tcp-raw-c2s.js
+++ b/benchmark/net/tcp-raw-c2s.js
@@ -90,7 +90,6 @@ function client() {
break;
default:
throw new Error('invalid type: ' + type);
- break;
}
var clientHandle = new TCP();
diff --git a/benchmark/net/tcp-raw-pipe.js b/benchmark/net/tcp-raw-pipe.js
index e22437f422..c05c816855 100644
--- a/benchmark/net/tcp-raw-pipe.js
+++ b/benchmark/net/tcp-raw-pipe.js
@@ -88,7 +88,6 @@ function client() {
break;
default:
throw new Error('invalid type: ' + type);
- break;
}
var clientHandle = new TCP();
diff --git a/benchmark/net/tcp-raw-s2c.js b/benchmark/net/tcp-raw-s2c.js
index 15f9578b77..822a74c679 100644
--- a/benchmark/net/tcp-raw-s2c.js
+++ b/benchmark/net/tcp-raw-s2c.js
@@ -62,7 +62,6 @@ function server() {
break;
default:
throw new Error('invalid type: ' + type);
- break;
}
clientHandle.readStart();
diff --git a/benchmark/path/basename-win32.js b/benchmark/path/basename-win32.js
index b8e2186612..a621459879 100644
--- a/benchmark/path/basename-win32.js
+++ b/benchmark/path/basename-win32.js
@@ -9,7 +9,7 @@ var bench = common.createBenchmark(main, {
'C:\\',
'C:\\foo',
'D:\\foo\\.bar.baz',
- ['E:\\foo\\.bar.baz','.baz'].join('|'),
+ ['E:\\foo\\.bar.baz', '.baz'].join('|'),
'foo',
'foo\\bar.',
['foo\\bar.', '.'].join('|'),
diff --git a/benchmark/static_http_server.js b/benchmark/static_http_server.js
index 3288caecb6..804f83c208 100644
--- a/benchmark/static_http_server.js
+++ b/benchmark/static_http_server.js
@@ -4,7 +4,7 @@ var http = require('http');
var concurrency = 30;
var port = 12346;
var n = 700;
-var bytes = 1024*5;
+var bytes = 1024 * 5;
var requests = 0;
var responses = 0;
@@ -20,7 +20,7 @@ var server = http.createServer(function(req, res) {
'Content-Length': body.length
});
res.end(body);
-})
+});
server.listen(port, function() {
var agent = new http.Agent();
diff --git a/benchmark/tls/throughput.js b/benchmark/tls/throughput.js
index 2e1147cdf9..cbc5ffc0fb 100644
--- a/benchmark/tls/throughput.js
+++ b/benchmark/tls/throughput.js
@@ -31,7 +31,7 @@ function main(conf) {
encoding = 'ascii';
break;
case 'utf':
- chunk = new Array(size/2 + 1).join('ü');
+ chunk = new Array(size / 2 + 1).join('ü');
encoding = 'utf8';
break;
default:
@@ -54,7 +54,6 @@ function main(conf) {
});
function write() {
- var i = 0;
while (false !== conn.write(chunk, encoding));
}
});
diff --git a/benchmark/tls/tls-connect.js b/benchmark/tls/tls-connect.js
index 0dd20e1fd2..a265989e04 100644
--- a/benchmark/tls/tls-connect.js
+++ b/benchmark/tls/tls-connect.js
@@ -1,8 +1,7 @@
'use strict';
-var assert = require('assert'),
- fs = require('fs'),
- path = require('path'),
- tls = require('tls');
+var fs = require('fs'),
+ path = require('path'),
+ tls = require('tls');
var common = require('../common.js');
var bench = common.createBenchmark(main, {
@@ -22,10 +21,10 @@ function main(conf) {
concurrency = +conf.concurrency;
var cert_dir = path.resolve(__dirname, '../../test/fixtures'),
- options = { key: fs.readFileSync(cert_dir + '/test_key.pem'),
- cert: fs.readFileSync(cert_dir + '/test_cert.pem'),
- ca: [ fs.readFileSync(cert_dir + '/test_ca.pem') ],
- ciphers: 'AES256-GCM-SHA384' };
+ options = { key: fs.readFileSync(cert_dir + '/test_key.pem'),
+ cert: fs.readFileSync(cert_dir + '/test_cert.pem'),
+ ca: [ fs.readFileSync(cert_dir + '/test_ca.pem') ],
+ ciphers: 'AES256-GCM-SHA384' };
server = tls.createServer(options, onConnection);
server.listen(common.PORT, onListening);
diff --git a/benchmark/util/inspect.js b/benchmark/util/inspect.js
index d8ba243faf..3312bd683b 100644
--- a/benchmark/util/inspect.js
+++ b/benchmark/util/inspect.js
@@ -10,7 +10,7 @@ function main(conf) {
bench.start();
for (var i = 0; i < n; i += 1) {
- var r = util.inspect({a: 'a', b: 'b', c: 'c', d: 'd'});
+ util.inspect({a: 'a', b: 'b', c: 'c', d: 'd'});
}
bench.end(n);
}