-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
benchmark: add benchmark utility for isNativeError function #61180
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
base: main
Are you sure you want to change the base?
benchmark: add benchmark utility for isNativeError function #61180
Conversation
|
Review requested:
|
RafaelGSS
left a comment
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'm not confident about how useful this benchmark is
|
|
||
| bench.start(); | ||
| for (let iteration = 0; iteration < n; iteration++) { | ||
| func(arg); |
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.
This is likely being optimized.
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.
Hi, I tried to fix this by using more arguments and variable arguments. 5fcf423
Any recommendations? |
benchmark/util/is-native-error.js
Outdated
|
|
||
| const func = { native: util, js: types }[version].isNativeError; | ||
|
|
||
| const testArgs = [args[argument], args[argument], args[argument]]; |
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.
Any reason for this? If I'm reading correctly, the elements are all equals.
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 wanted to provide more arguments.
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.
With
const testArg = testArgs[iteration % 3];
func(testArg)below, I'm still not sure I understand.
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.
You're right, it could be misleading for them all to be the same I changed them with different arguments.
9de3f6f
now "%3" alternative I use testArgs.length
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.
After the latest changes, I got a test failure because the benchmark was running with three configurations instead of the expected one or two. I’ve updated the code so each run uses only a single argument, matching the test infrastructure’s requirements. FYİ @RafaelGSS
added benchmark code for isNativeError function
for: #60468 (comment)