diff options
author | Rich Trott <rtrott@gmail.com> | 2017-06-21 00:37:00 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-07-18 20:57:15 +0300 |
commit | 3d0b66a7c2c1af88bbf5e7fe6963c20cf5fed652 (patch) | |
tree | 2063b8825e8e5676d97a7c5e4c31e1760fe45a46 /benchmark | |
parent | e5d32b8b13ba5e966ca844a272689911ee255ce4 (diff) |
benchmark,lib,test: use braces for multiline block
For if/else and loops where the bodies span more than one line, use
curly braces.
Original-PR-URL: https://github.com/nodejs/node/pull/13828
Ref: https://github.com/nodejs/node/pull/13623#discussion_r123048602
Original-Reviewed-By: Anna Henningsen <anna@addaleax.net>
Original-Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Original-Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Original-Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/13995
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/buffers/buffer-iterate.js | 13 | ||||
-rw-r--r-- | benchmark/dgram/array-vs-concat.js | 6 | ||||
-rw-r--r-- | benchmark/dgram/multi-buffer.js | 6 | ||||
-rw-r--r-- | benchmark/dgram/offset-length.js | 6 | ||||
-rw-r--r-- | benchmark/dgram/single-buffer.js | 6 | ||||
-rw-r--r-- | benchmark/url/url-searchparams-iteration.js | 3 |
6 files changed, 26 insertions, 14 deletions
diff --git a/benchmark/buffers/buffer-iterate.js b/benchmark/buffers/buffer-iterate.js index fb8abc1aee1..7c204442224 100644 --- a/benchmark/buffers/buffer-iterate.js +++ b/benchmark/buffers/buffer-iterate.js @@ -29,9 +29,11 @@ function main(conf) { function benchFor(buffer, n) { bench.start(); - for (var k = 0; k < n; k++) - for (var i = 0; i < buffer.length; i++) + for (var k = 0; k < n; k++) { + for (var i = 0; i < buffer.length; i++) { assert(buffer[i] === 0); + } + } bench.end(n); } @@ -39,10 +41,11 @@ function benchFor(buffer, n) { function benchForOf(buffer, n) { bench.start(); - for (var k = 0; k < n; k++) - for (var b of buffer) + for (var k = 0; k < n; k++) { + for (var b of buffer) { assert(b === 0); - + } + } bench.end(n); } diff --git a/benchmark/dgram/array-vs-concat.js b/benchmark/dgram/array-vs-concat.js index 8b1d34d0e74..681abd6afa1 100644 --- a/benchmark/dgram/array-vs-concat.js +++ b/benchmark/dgram/array-vs-concat.js @@ -46,17 +46,19 @@ function server() { var onsend = type === 'concat' ? onsendConcat : onsendMulti; function onsendConcat() { - if (sent++ % num === 0) + if (sent++ % num === 0) { for (var i = 0; i < num; i++) { socket.send(Buffer.concat(chunk), PORT, '127.0.0.1', onsend); } + } } function onsendMulti() { - if (sent++ % num === 0) + if (sent++ % num === 0) { for (var i = 0; i < num; i++) { socket.send(chunk, PORT, '127.0.0.1', onsend); } + } } socket.on('listening', function() { diff --git a/benchmark/dgram/multi-buffer.js b/benchmark/dgram/multi-buffer.js index 3277547119c..6a7fc9bfaf8 100644 --- a/benchmark/dgram/multi-buffer.js +++ b/benchmark/dgram/multi-buffer.js @@ -45,9 +45,11 @@ function server() { var socket = dgram.createSocket('udp4'); function onsend() { - if (sent++ % num === 0) - for (var i = 0; i < num; i++) + if (sent++ % num === 0) { + for (var i = 0; i < num; i++) { socket.send(chunk, PORT, '127.0.0.1', onsend); + } + } } socket.on('listening', function() { diff --git a/benchmark/dgram/offset-length.js b/benchmark/dgram/offset-length.js index 5b7762b21e7..b897707ded5 100644 --- a/benchmark/dgram/offset-length.js +++ b/benchmark/dgram/offset-length.js @@ -37,9 +37,11 @@ function server() { var socket = dgram.createSocket('udp4'); function onsend() { - if (sent++ % num === 0) - for (var i = 0; i < num; i++) + if (sent++ % num === 0) { + for (var i = 0; i < num; i++) { socket.send(chunk, 0, chunk.length, PORT, '127.0.0.1', onsend); + } + } } socket.on('listening', function() { diff --git a/benchmark/dgram/single-buffer.js b/benchmark/dgram/single-buffer.js index e01b60b4297..8b81d7fbfc0 100644 --- a/benchmark/dgram/single-buffer.js +++ b/benchmark/dgram/single-buffer.js @@ -37,9 +37,11 @@ function server() { var socket = dgram.createSocket('udp4'); function onsend() { - if (sent++ % num === 0) - for (var i = 0; i < num; i++) + if (sent++ % num === 0) { + for (var i = 0; i < num; i++) { socket.send(chunk, PORT, '127.0.0.1', onsend); + } + } } socket.on('listening', function() { diff --git a/benchmark/url/url-searchparams-iteration.js b/benchmark/url/url-searchparams-iteration.js index 833271ef306..89919af7255 100644 --- a/benchmark/url/url-searchparams-iteration.js +++ b/benchmark/url/url-searchparams-iteration.js @@ -32,11 +32,12 @@ function iterator(n) { const noDead = []; bench.start(); - for (var i = 0; i < n; i += 1) + for (var i = 0; i < n; i += 1) { for (var pair of params) { noDead[0] = pair[0]; noDead[1] = pair[1]; } + } bench.end(n); assert.strictEqual(noDead[0], 'three'); |