Skip to content

Commit 552d887

Browse files
brunocrohtargos
authored andcommitted
benchmark: update num to n in dgram offset-length
PR-URL: #59708 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 275c070 commit 552d887

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

benchmark/dgram/offset-length.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@ const common = require('../common.js');
55
const dgram = require('dgram');
66
const PORT = common.PORT;
77

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.
99
// Keep it reasonably high (>10) otherwise you're benchmarking the speed of
1010
// event loop cycles more than anything else.
1111
const bench = common.createBenchmark(main, {
1212
len: [1, 64, 256, 1024],
13-
num: [100],
13+
n: [100],
1414
type: ['send', 'recv'],
1515
dur: [5],
1616
});
1717

18-
function main({ dur, len, num, type }) {
18+
function main({ dur, len, n, type }) {
1919
const chunk = Buffer.allocUnsafe(len);
2020
let sent = 0;
2121
let received = 0;
2222
const socket = dgram.createSocket('udp4');
2323

2424
function onsend() {
25-
if (sent++ % num === 0) {
25+
if (sent++ % n === 0) {
2626
// The setImmediate() is necessary to have event loop progress on OSes
2727
// that only perform synchronous I/O on nonblocking UDP sockets.
2828
setImmediate(() => {
29-
for (let i = 0; i < num; i++) {
29+
for (let i = 0; i < n; i++) {
3030
socket.send(chunk, 0, chunk.length, PORT, '127.0.0.1', onsend);
3131
}
3232
});

0 commit comments

Comments
 (0)