Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-iterate.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function main(conf) {
var buffer = new clazz(len);
buffer.fill(0);

methods[conf.method](buffer, conf.n);
methods[conf.method](buffer, +conf.n);
}


Expand Down
4 changes: 2 additions & 2 deletions benchmark/crypto/aes-gcm-throughput.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ var bench = common.createBenchmark(main, {
});

function main(conf) {
var message = Buffer.alloc(conf.len, 'b');
var message = Buffer.alloc(+conf.len, 'b');
var key = crypto.randomBytes(keylen[conf.cipher]);
var iv = crypto.randomBytes(12);
var associate_data = Buffer.alloc(16, 'z');
bench.start();
AEAD_Bench(conf.cipher, message, associate_data, key, iv, conf.n, conf.len);
AEAD_Bench(conf.cipher, message, associate_data, key, iv, +conf.n, +conf.len);
}

function AEAD_Bench(cipher, message, associate_data, key, iv, n, len) {
Expand Down
8 changes: 4 additions & 4 deletions benchmark/crypto/cipher-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ function main(conf) {
var encoding;
switch (conf.type) {
case 'asc':
message = new Array(conf.len + 1).join('a');
message = new Array(+conf.len + 1).join('a');
encoding = 'ascii';
break;
case 'utf':
message = new Array(conf.len / 2 + 1).join('ü');
message = new Array(+conf.len / 2 + 1).join('ü');
encoding = 'utf8';
break;
case 'buf':
message = Buffer.alloc(conf.len, 'b');
message = Buffer.alloc(+conf.len, 'b');
break;
default:
throw new Error('unknown message type: ' + conf.type);
Expand All @@ -59,7 +59,7 @@ function main(conf) {
// write data as fast as possible to alice, and have bob decrypt.
// use old API for comparison to v0.8
bench.start();
fn(alice_cipher, bob_cipher, message, encoding, conf.writes);
fn(alice_cipher, bob_cipher, message, encoding, +conf.writes);
}

function streamWrite(alice, bob, message, encoding, writes) {
Expand Down
8 changes: 4 additions & 4 deletions benchmark/crypto/hash-stream-creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ function main(conf) {
var encoding;
switch (conf.type) {
case 'asc':
message = new Array(conf.len + 1).join('a');
message = new Array(+conf.len + 1).join('a');
encoding = 'ascii';
break;
case 'utf':
message = new Array(conf.len / 2 + 1).join('ü');
message = new Array(+conf.len / 2 + 1).join('ü');
encoding = 'utf8';
break;
case 'buf':
message = Buffer.alloc(conf.len, 'b');
message = Buffer.alloc(+conf.len, 'b');
break;
default:
throw new Error('unknown message type: ' + conf.type);
Expand All @@ -42,7 +42,7 @@ function main(conf) {
var fn = api === 'stream' ? streamWrite : legacyWrite;

bench.start();
fn(conf.algo, message, encoding, conf.writes, conf.len, conf.out);
fn(conf.algo, message, encoding, +conf.writes, +conf.len, conf.out);
}

function legacyWrite(algo, message, encoding, writes, len, outEnc) {
Expand Down
8 changes: 4 additions & 4 deletions benchmark/crypto/hash-stream-throughput.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ function main(conf) {
var encoding;
switch (conf.type) {
case 'asc':
message = new Array(conf.len + 1).join('a');
message = new Array(+conf.len + 1).join('a');
encoding = 'ascii';
break;
case 'utf':
message = new Array(conf.len / 2 + 1).join('ü');
message = new Array(+conf.len / 2 + 1).join('ü');
encoding = 'utf8';
break;
case 'buf':
message = Buffer.alloc(conf.len, 'b');
message = Buffer.alloc(+conf.len, 'b');
break;
default:
throw new Error('unknown message type: ' + conf.type);
Expand All @@ -41,7 +41,7 @@ function main(conf) {
var fn = api === 'stream' ? streamWrite : legacyWrite;

bench.start();
fn(conf.algo, message, encoding, conf.writes, conf.len);
fn(conf.algo, message, encoding, +conf.writes, +conf.len);
}

function legacyWrite(algo, message, encoding, writes, len) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/crypto/rsa-encrypt-decrypt-throughput.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ var bench = common.createBenchmark(main, {
});

function main(conf) {
var message = Buffer.alloc(conf.len, 'b');
var message = Buffer.alloc(+conf.len, 'b');
bench.start();
StreamWrite(conf.algo, conf.keylen, message, conf.n, conf.len);
StreamWrite(conf.algo, conf.keylen, message, +conf.n, +conf.len);
}

function StreamWrite(algo, keylen, message, n, len) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/crypto/rsa-sign-verify-throughput.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ var bench = common.createBenchmark(main, {
});

function main(conf) {
var message = Buffer.alloc(conf.len, 'b');
var message = Buffer.alloc(+conf.len, 'b');
bench.start();
StreamWrite(conf.algo, conf.keylen, message, conf.writes, conf.len);
StreamWrite(conf.algo, conf.keylen, message, +conf.writes, +conf.len);
}

function StreamWrite(algo, keylen, message, writes, len) {
Expand Down
1 change: 1 addition & 0 deletions benchmark/dgram/array-vs-concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ function server() {
var bytes = sent * len;
var gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);
});

Expand Down
1 change: 1 addition & 0 deletions benchmark/dgram/multi-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function server() {
var bytes = (type === 'send' ? sent : received) * len;
var gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);
});

Expand Down
1 change: 1 addition & 0 deletions benchmark/dgram/offset-length.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ function server() {
var bytes = (type === 'send' ? sent : received) * chunk.length;
var gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);
});

Expand Down
1 change: 1 addition & 0 deletions benchmark/dgram/single-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ function server() {
var bytes = (type === 'send' ? sent : received) * chunk.length;
var gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);
});

Expand Down
2 changes: 1 addition & 1 deletion benchmark/domain/domain-fn-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var gargs = [1, 2, 3];
function main(conf) {

var args, n = +conf.n;
var myArguments = gargs.slice(0, conf.arguments);
var myArguments = gargs.slice(0, +conf.arguments);
bench.start();

bdomain.enter();
Expand Down
1 change: 1 addition & 0 deletions benchmark/fs/readfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function main(conf) {
setTimeout(function() {
bench.end(reads);
try { fs.unlinkSync(filename); } catch (e) {}
process.exit(0);
}, +conf.dur * 1000);

function read() {
Expand Down
1 change: 1 addition & 0 deletions benchmark/http/_chunky_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ function main(conf) {
count += 1;
if (count === num) {
bench.end(count);
process.exit(0);
} else {
WriteHTTPHeaders(socket, 1, min + size);
}
Expand Down
4 changes: 2 additions & 2 deletions benchmark/http/chunked.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var bench = common.createBenchmark(main, {

function main(conf) {
const http = require('http');
var chunk = Buffer.alloc(conf.size, '8');
var chunk = Buffer.alloc(+conf.size, '8');

var args = ['-d', '10s', '-t', 8, '-c', conf.c];

Expand All @@ -30,7 +30,7 @@ function main(conf) {
send(left - 1);
}, 0);
}
send(conf.num);
send(+conf.num);
});

server.listen(common.PORT, function() {
Expand Down
1 change: 1 addition & 0 deletions benchmark/http/client-request-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@ function main(conf) {

function done() {
bench.end(nreqs);
process.exit(0);
}
}
2 changes: 1 addition & 1 deletion benchmark/http/end-vs-write-end.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var bench = common.createBenchmark(main, {
function main(conf) {
const http = require('http');
var chunk;
var len = conf.kb * 1024;
var len = +conf.kb * 1024;
switch (conf.type) {
case 'buf':
chunk = Buffer.alloc(len, 'x');
Expand Down
8 changes: 4 additions & 4 deletions benchmark/misc/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,16 @@ function main(conf) {
const n = +conf.n;
switch (conf.method) {
case 'restAndSpread':
runUsingRestAndSpread(n, conf.concat);
runUsingRestAndSpread(n, +conf.concat);
break;
case 'restAndApply':
runUsingRestAndApply(n, conf.concat);
runUsingRestAndApply(n, +conf.concat);
break;
case 'argumentsAndApply':
runUsingArgumentsAndApply(n, conf.concat);
runUsingArgumentsAndApply(n, +conf.concat);
break;
case 'restAndConcat':
if (conf.concat)
if (+conf.concat)
runUsingRestAndConcat(n);
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion benchmark/misc/freelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var bench = common.createBenchmark(main, {
});

function main(conf) {
var n = conf.n;
var n = +conf.n;
var poolSize = 1000;
var list = new FreeList('test', poolSize, Object);
var i;
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/net-c2s-cork.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ function server() {
var bytes = writer.received;
var gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);

function send() {
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/net-c2s.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ function server() {
var bytes = writer.received;
var gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);
});
});
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/net-pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ function server() {
var bytes = writer.received * 2;
var gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);
});
});
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/net-s2c.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ function server() {
var bytes = writer.received;
var gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);
});
});
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/tcp-raw-c2s.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function server() {
setTimeout(function() {
// report in Gb/sec
bench.end((bytes * 8) / (1024 * 1024 * 1024));
process.exit(0);
}, dur * 1000);

clientHandle.onread = function(nread, buffer) {
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/tcp-raw-pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ function client() {
// multiply by 2 since we're sending it first one way
// then then back again.
bench.end(2 * (bytes * 8) / (1024 * 1024 * 1024));
process.exit(0);
}, dur * 1000);

while (clientHandle.writeQueueSize === 0)
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/tcp-raw-s2c.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ function client() {
setTimeout(function() {
// report in Gb/sec
bench.end((bytes * 8) / (1024 * 1024 * 1024));
process.exit(0);
}, dur * 1000);
};
}
1 change: 1 addition & 0 deletions benchmark/tls/tls-connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ function done() {
// don't always match. Generally, serverConn will be
// the smaller number, but take the min just to be sure.
bench.end(Math.min(serverConn, clientConn));
process.exit(0);
}