MCPcopy Index your code
hub / github.com/nodejs/node / main

Function main

benchmark/dgram/bind-params.js:15–46  ·  view source on GitHub ↗
({ n, port, address })

Source from the content-addressed store, hash-verified

13const noop = () => {};
14
15function main({ n, port, address }) {
16 port = port === 'true' ? 0 : undefined;
17 address = address === 'true' ? '0.0.0.0' : undefined;
18
19 if (port !== undefined && address !== undefined) {
20 bench.start();
21 for (let i = 0; i < n; i++) {
22 dgram.createSocket('udp4').bind(port, address)
23 .on('error', noop)
24 .unref();
25 }
26 bench.end(n);
27 } else if (port !== undefined) {
28 bench.start();
29 for (let i = 0; i < n; i++) {
30 dgram.createSocket('udp4')
31 .bind(port)
32 .on('error', noop)
33 .unref();
34 }
35 bench.end(n);
36 } else if (port === undefined && address === undefined) {
37 bench.start();
38 for (let i = 0; i < n; i++) {
39 dgram.createSocket('udp4')
40 .bind()
41 .on('error', noop)
42 .unref();
43 }
44 bench.end(n);
45 }
46}

Callers

nothing calls this directly

Calls 6

createSocketMethod · 0.80
startMethod · 0.45
unrefMethod · 0.45
onMethod · 0.45
bindMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…