Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

benchmark: fix dgram/bind-params.js benchmark #14948

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions benchmark/dgram/bind-params.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,27 @@ function main(conf) {
if (port !== undefined && address !== undefined) {
bench.start();
for (let i = 0; i < n; i++) {
dgram.createSocket('udp4').bind(port, address).unref();
dgram.createSocket('udp4').bind(port, address)
.on('error', () => {})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps pull this out to avoid creating n functions? I'm not sure what V8 optimizes away these days.

.unref();
}
bench.end(n);
} else if (port !== undefined) {
bench.start();
for (let i = 0; i < n; i++) {
dgram.createSocket('udp4').bind(port).unref();
dgram.createSocket('udp4')
.bind(port)
.on('error', () => {})
.unref();
}
bench.end(n);
} else if (port === undefined && address === undefined) {
bench.start();
for (let i = 0; i < n; i++) {
dgram.createSocket('udp4').bind().unref();
dgram.createSocket('udp4')
.bind()
.on('error', () => {})
.unref();
}
bench.end(n);
}
Expand Down