-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: add benchmark for buf.compare() #5441
Conversation
There is a benchmark for the class method `Buffer.compare()` but not for the instance method `buf.compare()`. This adds that benchmark. I used this to confirm a performance regression in an implementation I was considering. While the implementation was a bust, it does seem like the benchmark is worthwhile. The benchmark is nearly identical to the existing `Buffer.compare()` benchmark except, of course, that it calls `buf.compare()` instead.
var b1 = new Buffer(size).fill('a'); | ||
|
||
b1[size - 1] = 'b'.charCodeAt(0); | ||
|
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.
Please insert code to force optimization of b0.compare
before starting the benchmark. Take a look at some of the other (e.g. path
) benchmarks to see how to do this.
|
LGTM |
b1[size - 1] = 'b'.charCodeAt(0); | ||
|
||
// Force optimization before starting the benchmark | ||
b0.compare(b0, b1); |
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 and the other instance below should instead be b0.compare(b1);
|
LGTM |
There is a benchmark for the class method `Buffer.compare()` but not for the instance method `buf.compare()`. This adds that benchmark. I used this to confirm a performance regression in an implementation I was considering. While the implementation was a bust, it does seem like the benchmark is worthwhile. The benchmark is nearly identical to the existing `Buffer.compare()` benchmark except, of course, that it calls `buf.compare()` instead. PR-URL: nodejs#5441 Reviewed-By: Brian White <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
Landed in ffdc046 |
There is a benchmark for the class method `Buffer.compare()` but not for the instance method `buf.compare()`. This adds that benchmark. I used this to confirm a performance regression in an implementation I was considering. While the implementation was a bust, it does seem like the benchmark is worthwhile. The benchmark is nearly identical to the existing `Buffer.compare()` benchmark except, of course, that it calls `buf.compare()` instead. PR-URL: #5441 Reviewed-By: Brian White <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
There is a benchmark for the class method `Buffer.compare()` but not for the instance method `buf.compare()`. This adds that benchmark. I used this to confirm a performance regression in an implementation I was considering. While the implementation was a bust, it does seem like the benchmark is worthwhile. The benchmark is nearly identical to the existing `Buffer.compare()` benchmark except, of course, that it calls `buf.compare()` instead. PR-URL: #5441 Reviewed-By: Brian White <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
There is a benchmark for the class method `Buffer.compare()` but not for the instance method `buf.compare()`. This adds that benchmark. I used this to confirm a performance regression in an implementation I was considering. While the implementation was a bust, it does seem like the benchmark is worthwhile. The benchmark is nearly identical to the existing `Buffer.compare()` benchmark except, of course, that it calls `buf.compare()` instead. PR-URL: #5441 Reviewed-By: Brian White <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
There is a benchmark for the class method
Buffer.compare()
but not forthe instance method
buf.compare()
. This adds that benchmark.I used this to confirm a performance regression in an implementation I
was considering. While the implementation was a bust, it does seem like
the benchmark is worthwhile.
The benchmark is nearly identical to the existing
Buffer.compare()
benchmark except, of course, that it calls
buf.compare()
instead.