summaryrefslogtreecommitdiff
path: root/benchmark/net/net-pipe.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2017-09-13 22:48:53 -0300
committerRuben Bridgewater <ruben@bridgewater.de>2017-09-19 21:14:38 -0300
commite167ab71fb113fa38866dd11aa99af7079fb463c (patch)
tree3d91ca0f6e60d08fcab70833b851335e41b53cd0 /benchmark/net/net-pipe.js
parentb1c8f15c5f169e021f7c46eb7b219de95fe97603 (diff)
downloadandroid-node-v8-e167ab71fb113fa38866dd11aa99af7079fb463c.tar.gz
android-node-v8-e167ab71fb113fa38866dd11aa99af7079fb463c.tar.bz2
android-node-v8-e167ab71fb113fa38866dd11aa99af7079fb463c.zip
benchmark: var to const
PR-URL: https://github.com/nodejs/node/pull/13757 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'benchmark/net/net-pipe.js')
-rw-r--r--benchmark/net/net-pipe.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/benchmark/net/net-pipe.js b/benchmark/net/net-pipe.js
index 507640f8ce..a8ae50edfb 100644
--- a/benchmark/net/net-pipe.js
+++ b/benchmark/net/net-pipe.js
@@ -1,10 +1,10 @@
// test the speed of .pipe() with sockets
'use strict';
-var common = require('../common.js');
-var PORT = common.PORT;
+const common = require('../common.js');
+const PORT = common.PORT;
-var bench = common.createBenchmark(main, {
+const bench = common.createBenchmark(main, {
len: [102400, 1024 * 1024 * 16],
type: ['utf', 'asc', 'buf'],
dur: [5],
@@ -40,7 +40,7 @@ function main(conf) {
server();
}
-var net = require('net');
+const net = require('net');
function Writer() {
this.received = 0;
@@ -66,8 +66,8 @@ Writer.prototype.prependListener = function() {};
function flow() {
- var dest = this.dest;
- var res = dest.write(chunk, encoding);
+ const dest = this.dest;
+ const res = dest.write(chunk, encoding);
if (!res)
dest.once('drain', this.flow);
else
@@ -87,16 +87,16 @@ Reader.prototype.pipe = function(dest) {
function server() {
- var reader = new Reader();
- var writer = new Writer();
+ const reader = new Reader();
+ const writer = new Writer();
// the actual benchmark.
- var server = net.createServer(function(socket) {
+ const server = net.createServer(function(socket) {
socket.pipe(socket);
});
server.listen(PORT, function() {
- var socket = net.connect(PORT);
+ const socket = net.connect(PORT);
socket.on('connect', function() {
bench.start();
@@ -106,8 +106,8 @@ function server() {
setTimeout(function() {
// multiply by 2 since we're sending it first one way
// then then back again.
- var bytes = writer.received * 2;
- var gbits = (bytes * 8) / (1024 * 1024 * 1024);
+ const bytes = writer.received * 2;
+ const gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);