-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
benchmarks: add dgram bind(+/- params) benchmark #11313
Conversation
//cc @nodejs/benchmarking |
benchmark/dgram/bind-params.js
Outdated
} | ||
bench.end(n); | ||
} else if (address !== undefined) { | ||
// Skip: the same as the previous case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this section can be omitted entirely (e.g. use address === undefined && port !== undefined
for the below conditional)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, in this case, the last else
should be replaced by else if (address === undefined && port === undefined)
, should not it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's basically what I was suggesting, yes. Except perhaps it would be better to reverse the checks to match the same order used in the first conditional:
} else if (port !== undefined && address === undefined) {
or we could just remove the middle section entirely and it should still work as-is:
} else if (port !== undefined) {
benchmark/dgram/bind-params.js
Outdated
const numberOfOperations = 1e4; | ||
|
||
const configs = { | ||
n: [numberOfOperations], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should just use the literal value inline, since it's the only place the variable is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I've just linted with no-magic-numbers, but this is not Node.js mandatory rule. I will fix it.
@mscdex Fixed (the results of comparing updated). |
Linter shows green, LGTM. |
Landed in 1162e28 |
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
benchmarks, dgram
This is a benchmark for this case requsted here.
An output from a separate run:
Before fix:
After fix:
An output from a comparing run: