diff --git a/benchmark/dgram/array-vs-concat.js b/benchmark/dgram/array-vs-concat.js index d260a48063d489..ae9a759a983c04 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 ea1f430eed929b..5f7999f7a39241 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 7b69a82255ed4b..add77cd7845ce1 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 696fa6a7a0c0bd..eea0b75b773ca8 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 5c95b17887d37a..b02f785bb052f2 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); } });