summaryrefslogtreecommitdiff
path: root/benchmark/dgram
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/dgram
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/dgram')
-rw-r--r--benchmark/dgram/array-vs-concat.js12
-rw-r--r--benchmark/dgram/multi-buffer.js10
-rw-r--r--benchmark/dgram/offset-length.js10
-rw-r--r--benchmark/dgram/single-buffer.js10
4 files changed, 21 insertions, 21 deletions
diff --git a/benchmark/dgram/array-vs-concat.js b/benchmark/dgram/array-vs-concat.js
index 681abd6afa..7ee4e2d3ac 100644
--- a/benchmark/dgram/array-vs-concat.js
+++ b/benchmark/dgram/array-vs-concat.js
@@ -7,7 +7,7 @@ const PORT = common.PORT;
// `num` is the number of send requests to queue up each time.
// Keep it reasonably high (>10) otherwise you're benchmarking the speed of
// event loop cycles more than anything else.
-var bench = common.createBenchmark(main, {
+const bench = common.createBenchmark(main, {
len: [64, 256, 512, 1024],
num: [100],
chunks: [1, 2, 4, 8],
@@ -37,13 +37,13 @@ function main(conf) {
server();
}
-var dgram = require('dgram');
+const dgram = require('dgram');
function server() {
var sent = 0;
- var socket = dgram.createSocket('udp4');
+ const socket = dgram.createSocket('udp4');
- var onsend = type === 'concat' ? onsendConcat : onsendMulti;
+ const onsend = type === 'concat' ? onsendConcat : onsendMulti;
function onsendConcat() {
if (sent++ % num === 0) {
@@ -66,8 +66,8 @@ function server() {
onsend();
setTimeout(function() {
- var bytes = sent * len;
- var gbits = (bytes * 8) / (1024 * 1024 * 1024);
+ const bytes = sent * len;
+ const gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);
diff --git a/benchmark/dgram/multi-buffer.js b/benchmark/dgram/multi-buffer.js
index a0285c8c59..15f70760ab 100644
--- a/benchmark/dgram/multi-buffer.js
+++ b/benchmark/dgram/multi-buffer.js
@@ -7,7 +7,7 @@ const PORT = common.PORT;
// `num` is the number of send requests to queue up each time.
// Keep it reasonably high (>10) otherwise you're benchmarking the speed of
// event loop cycles more than anything else.
-var bench = common.createBenchmark(main, {
+const bench = common.createBenchmark(main, {
len: [64, 256, 1024],
num: [100],
chunks: [1, 2, 4, 8],
@@ -37,12 +37,12 @@ function main(conf) {
server();
}
-var dgram = require('dgram');
+const dgram = require('dgram');
function server() {
var sent = 0;
var received = 0;
- var socket = dgram.createSocket('udp4');
+ const socket = dgram.createSocket('udp4');
function onsend() {
if (sent++ % num === 0) {
@@ -57,8 +57,8 @@ function server() {
onsend();
setTimeout(function() {
- var bytes = (type === 'send' ? sent : received) * len;
- var gbits = (bytes * 8) / (1024 * 1024 * 1024);
+ const bytes = (type === 'send' ? sent : received) * len;
+ const gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);
diff --git a/benchmark/dgram/offset-length.js b/benchmark/dgram/offset-length.js
index 0445f7b70b..7f5a02afe5 100644
--- a/benchmark/dgram/offset-length.js
+++ b/benchmark/dgram/offset-length.js
@@ -7,7 +7,7 @@ const PORT = common.PORT;
// `num` is the number of send requests to queue up each time.
// Keep it reasonably high (>10) otherwise you're benchmarking the speed of
// event loop cycles more than anything else.
-var bench = common.createBenchmark(main, {
+const bench = common.createBenchmark(main, {
len: [1, 64, 256, 1024],
num: [100],
type: ['send', 'recv'],
@@ -29,12 +29,12 @@ function main(conf) {
server();
}
-var dgram = require('dgram');
+const dgram = require('dgram');
function server() {
var sent = 0;
var received = 0;
- var socket = dgram.createSocket('udp4');
+ const socket = dgram.createSocket('udp4');
function onsend() {
if (sent++ % num === 0) {
@@ -49,8 +49,8 @@ function server() {
onsend();
setTimeout(function() {
- var bytes = (type === 'send' ? sent : received) * chunk.length;
- var gbits = (bytes * 8) / (1024 * 1024 * 1024);
+ const bytes = (type === 'send' ? sent : received) * chunk.length;
+ const gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);
diff --git a/benchmark/dgram/single-buffer.js b/benchmark/dgram/single-buffer.js
index e5fcac63f6..454662b542 100644
--- a/benchmark/dgram/single-buffer.js
+++ b/benchmark/dgram/single-buffer.js
@@ -7,7 +7,7 @@ const PORT = common.PORT;
// `num` is the number of send requests to queue up each time.
// Keep it reasonably high (>10) otherwise you're benchmarking the speed of
// event loop cycles more than anything else.
-var bench = common.createBenchmark(main, {
+const bench = common.createBenchmark(main, {
len: [1, 64, 256, 1024],
num: [100],
type: ['send', 'recv'],
@@ -29,12 +29,12 @@ function main(conf) {
server();
}
-var dgram = require('dgram');
+const dgram = require('dgram');
function server() {
var sent = 0;
var received = 0;
- var socket = dgram.createSocket('udp4');
+ const socket = dgram.createSocket('udp4');
function onsend() {
if (sent++ % num === 0) {
@@ -49,8 +49,8 @@ function server() {
onsend();
setTimeout(function() {
- var bytes = (type === 'send' ? sent : received) * chunk.length;
- var gbits = (bytes * 8) / (1024 * 1024 * 1024);
+ const bytes = (type === 'send' ? sent : received) * chunk.length;
+ const gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);