@@ -5,18 +5,18 @@ const common = require('../common.js');
|
5 | 5 | const dgram = require('dgram'); |
6 | 6 | const PORT = common.PORT; |
7 | 7 | |
8 | | -// `num` is the number of send requests to queue up each time. |
| 8 | +// `n` is the number of send requests to queue up each time. |
9 | 9 | // Keep it reasonably high (>10) otherwise you're benchmarking the speed of |
10 | 10 | // event loop cycles more than anything else. |
11 | 11 | const bench = common.createBenchmark(main, { |
12 | | -len: [64, 256, 1024], |
13 | | -num: [100], |
14 | | -chunks: [1, 2, 4, 8], |
| 12 | +len: [64, 512, 1024], |
| 13 | +n: [100], |
| 14 | +chunks: [1, 8], |
15 | 15 | type: ['send', 'recv'], |
16 | 16 | dur: [5], |
17 | 17 | }); |
18 | 18 | |
19 | | -function main({ dur, len, num, type, chunks }) { |
| 19 | +function main({ dur, len, n, type, chunks }) { |
20 | 20 | const chunk = []; |
21 | 21 | for (let i = 0; i < chunks; i++) { |
22 | 22 | chunk.push(Buffer.allocUnsafe(Math.round(len / chunks))); |
@@ -26,11 +26,11 @@ function main({ dur, len, num, type, chunks }) {
|
26 | 26 | const socket = dgram.createSocket('udp4'); |
27 | 27 | |
28 | 28 | function onsend() { |
29 | | -if (sent++ % num === 0) { |
| 29 | +if (sent++ % n === 0) { |
30 | 30 | // The setImmediate() is necessary to have event loop progress on OSes |
31 | 31 | // that only perform synchronous I/O on nonblocking UDP sockets. |
32 | 32 | setImmediate(() => { |
33 | | -for (let i = 0; i < num; i++) { |
| 33 | +for (let i = 0; i < n; i++) { |
34 | 34 | socket.send(chunk, PORT, '127.0.0.1', onsend); |
35 | 35 | } |
36 | 36 | }); |
|