GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — benchmark: calibrate config dgram multi-buffer · nodejs/node@cbec4fd

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • benchmark/dgram
    • multi-buffer.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎benchmark/dgram/multi-buffer.js‎

Copy file name to clipboardExpand all lines: benchmark/dgram/multi-buffer.js
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ 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, {
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],
1515
type: ['send', 'recv'],
1616
dur: [5],
1717
});
1818

19-
function main({ dur, len, num, type, chunks }) {
19+
function main({ dur, len, n, type, chunks }) {
2020
const chunk = [];
2121
for (let i = 0; i < chunks; i++) {
2222
chunk.push(Buffer.allocUnsafe(Math.round(len / chunks)));
@@ -26,11 +26,11 @@ function main({ dur, len, num, type, chunks }) {
2626
const socket = dgram.createSocket('udp4');
2727

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

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.