8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cee3622 commit 78efd1bCopy full SHA for 78efd1b
benchmark/dgram/offset-length.js
@@ -5,28 +5,28 @@ const common = require('../common.js');
5
const dgram = require('dgram');
6
const PORT = common.PORT;
7
8
-// `num` is the number of send requests to queue up each time.
+// `n` is the number of send requests to queue up each time.
9
// Keep it reasonably high (>10) otherwise you're benchmarking the speed of
10
// event loop cycles more than anything else.
11
const bench = common.createBenchmark(main, {
12
len: [1, 64, 256, 1024],
13
- num: [100],
+ n: [100],
14
type: ['send', 'recv'],
15
dur: [5],
16
});
17
18
-function main({ dur, len, num, type }) {
+function main({ dur, len, n, type }) {
19
const chunk = Buffer.allocUnsafe(len);
20
let sent = 0;
21
let received = 0;
22
const socket = dgram.createSocket('udp4');
23
24
function onsend() {
25
- if (sent++ % num === 0) {
+ if (sent++ % n === 0) {
26
// The setImmediate() is necessary to have event loop progress on OSes
27
// that only perform synchronous I/O on nonblocking UDP sockets.
28
setImmediate(() => {
29
- for (let i = 0; i < num; i++) {
+ for (let i = 0; i < n; i++) {
30
socket.send(chunk, 0, chunk.length, PORT, '127.0.0.1', onsend);
31
}
32