diff options
Diffstat (limited to 'benchmark/dgram')
-rw-r--r-- | benchmark/dgram/array-vs-concat.js | 8 | ||||
-rw-r--r-- | benchmark/dgram/bind-params.js | 7 | ||||
-rw-r--r-- | benchmark/dgram/multi-buffer.js | 8 | ||||
-rw-r--r-- | benchmark/dgram/offset-length.js | 6 | ||||
-rw-r--r-- | benchmark/dgram/single-buffer.js | 6 |
5 files changed, 17 insertions, 18 deletions
diff --git a/benchmark/dgram/array-vs-concat.js b/benchmark/dgram/array-vs-concat.js index d260a48063d..ae9a759a983 100644 --- a/benchmark/dgram/array-vs-concat.js +++ b/benchmark/dgram/array-vs-concat.js @@ -18,12 +18,12 @@ const bench = common.createBenchmark(main, { function main({ dur, len, num, type, chunks }) { const chunk = []; - for (var i = 0; i < chunks; i++) { + for (let i = 0; i < chunks; i++) { chunk.push(Buffer.allocUnsafe(Math.round(len / chunks))); } // Server - var sent = 0; + let sent = 0; const socket = dgram.createSocket('udp4'); const onsend = type === 'concat' ? onsendConcat : onsendMulti; @@ -32,7 +32,7 @@ function main({ dur, len, num, type, chunks }) { // The setImmediate() is necessary to have event loop progress on OSes // that only perform synchronous I/O on nonblocking UDP sockets. setImmediate(() => { - for (var i = 0; i < num; i++) { + for (let i = 0; i < num; i++) { socket.send(Buffer.concat(chunk), PORT, '127.0.0.1', onsend); } }); @@ -44,7 +44,7 @@ function main({ dur, len, num, type, chunks }) { // The setImmediate() is necessary to have event loop progress on OSes // that only perform synchronous I/O on nonblocking UDP sockets. setImmediate(() => { - for (var i = 0; i < num; i++) { + for (let i = 0; i < num; i++) { socket.send(chunk, PORT, '127.0.0.1', onsend); } }); diff --git a/benchmark/dgram/bind-params.js b/benchmark/dgram/bind-params.js index ea1f430eed9..5f7999f7a39 100644 --- a/benchmark/dgram/bind-params.js +++ b/benchmark/dgram/bind-params.js @@ -15,11 +15,10 @@ const noop = () => {}; function main({ n, port, address }) { port = port === 'true' ? 0 : undefined; address = address === 'true' ? '0.0.0.0' : undefined; - var i; if (port !== undefined && address !== undefined) { bench.start(); - for (i = 0; i < n; i++) { + for (let i = 0; i < n; i++) { dgram.createSocket('udp4').bind(port, address) .on('error', noop) .unref(); @@ -27,7 +26,7 @@ function main({ n, port, address }) { bench.end(n); } else if (port !== undefined) { bench.start(); - for (i = 0; i < n; i++) { + for (let i = 0; i < n; i++) { dgram.createSocket('udp4') .bind(port) .on('error', noop) @@ -36,7 +35,7 @@ function main({ n, port, address }) { bench.end(n); } else if (port === undefined && address === undefined) { bench.start(); - for (i = 0; i < n; i++) { + for (let i = 0; i < n; i++) { dgram.createSocket('udp4') .bind() .on('error', noop) diff --git a/benchmark/dgram/multi-buffer.js b/benchmark/dgram/multi-buffer.js index 7b69a82255e..add77cd7845 100644 --- a/benchmark/dgram/multi-buffer.js +++ b/benchmark/dgram/multi-buffer.js @@ -18,11 +18,11 @@ const bench = common.createBenchmark(main, { function main({ dur, len, num, type, chunks }) { const chunk = []; - for (var i = 0; i < chunks; i++) { + for (let i = 0; i < chunks; i++) { chunk.push(Buffer.allocUnsafe(Math.round(len / chunks))); } - var sent = 0; - var received = 0; + let sent = 0; + let received = 0; const socket = dgram.createSocket('udp4'); function onsend() { @@ -30,7 +30,7 @@ function main({ dur, len, num, type, chunks }) { // The setImmediate() is necessary to have event loop progress on OSes // that only perform synchronous I/O on nonblocking UDP sockets. setImmediate(() => { - for (var i = 0; i < num; i++) { + for (let i = 0; i < num; i++) { socket.send(chunk, PORT, '127.0.0.1', onsend); } }); diff --git a/benchmark/dgram/offset-length.js b/benchmark/dgram/offset-length.js index 696fa6a7a0c..eea0b75b773 100644 --- a/benchmark/dgram/offset-length.js +++ b/benchmark/dgram/offset-length.js @@ -17,8 +17,8 @@ const bench = common.createBenchmark(main, { function main({ dur, len, num, type }) { const chunk = Buffer.allocUnsafe(len); - var sent = 0; - var received = 0; + let sent = 0; + let received = 0; const socket = dgram.createSocket('udp4'); function onsend() { @@ -26,7 +26,7 @@ function main({ dur, len, num, type }) { // The setImmediate() is necessary to have event loop progress on OSes // that only perform synchronous I/O on nonblocking UDP sockets. setImmediate(() => { - for (var i = 0; i < num; i++) { + for (let i = 0; i < num; i++) { socket.send(chunk, 0, chunk.length, PORT, '127.0.0.1', onsend); } }); diff --git a/benchmark/dgram/single-buffer.js b/benchmark/dgram/single-buffer.js index 5c95b17887d..b02f785bb05 100644 --- a/benchmark/dgram/single-buffer.js +++ b/benchmark/dgram/single-buffer.js @@ -17,8 +17,8 @@ const bench = common.createBenchmark(main, { function main({ dur, len, num, type }) { const chunk = Buffer.allocUnsafe(len); - var sent = 0; - var received = 0; + let sent = 0; + let received = 0; const socket = dgram.createSocket('udp4'); function onsend() { @@ -26,7 +26,7 @@ function main({ dur, len, num, type }) { // The setImmediate() is necessary to have event loop progress on OSes // that only perform synchronous I/O on nonblocking UDP sockets. setImmediate(() => { - for (var i = 0; i < num; i++) { + for (let i = 0; i < num; i++) { socket.send(chunk, PORT, '127.0.0.1', onsend); } }); |