Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.4k
buffer:Performance increase for buffer-indexof#7658
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
adrian-nitu-92 commented Jul 11, 2016 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
cjihrig commented Jul 11, 2016
Do you have performance numbers for this? |
lib/buffer.js Outdated
mscdexJul 11, 2016 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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.
Missing indentation
adrian-nitu-92 commented Jul 12, 2016
Performance numbers available at, as measured on: |
adrian-nitu-92 commented Jul 12, 2016
Implemented requested changes :D |
mscdex commented Jul 12, 2016 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
What if we just changed the |
adrian-nitu-92 commented Jul 12, 2016
I looked into that, it gets slightly lower performance(under 1% lower). |
adrian-nitu-92 commented Jul 12, 2016
Any comments on the (typeof byteOffset === 'string') condition? It feels really awkward :D |
mscdex commented Jul 12, 2016 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
|
adrian-nitu-92 commented Jul 18, 2016
So I gather I should just simplify the patch according to mscdex's comments and resend my patch |
jasnell commented Aug 8, 2016
@adrian-nitu-92 ... sorry for the delay, updating this PR would be the way to do it. If you're still interested in moving this forward, simply add the new commits here and we'll take a look! :-) |
We are currently analyzing the buffer-indexof performance and noticed that a considerable amount of time is spent in the isNan() function. By simplifying this check we notice a small perf boost. Signed-off-by: Adrian Nitu <[email protected]>
adrian-nitu-92 commented Aug 9, 2016
Thank you for the feedback, I simplified my patch |
Trott commented Sep 7, 2016
@nodejs/buffer @nodejs/benchmarking @mscdex |
imyller commented Sep 25, 2016
jasnell 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.
LGTM
ThePrimeagen commented Sep 27, 2016 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@adrian-nitu-92 could you put a comment explaining what you are doing? Its clever, and clever often leads to misunderstanding. A quick comment should alleviate what looks like a bug. The comment below is somewhat misleading, you could also just clean that up. |
jasnell commented Jan 6, 2017
Is this still something that should happen? |
mscdex commented Jan 6, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
I think adding a comment above the conditional might be a good idea. Either way it LGTM. |
mhdawson 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 agree adding a comment explaining what and how the check accomplishes would be useful. Its not obvious otherwise
trevnorris commented Jan 11, 2017
Would be worth it to run this with |
mscdex commented Jan 11, 2017
@trevnorris I'm not sure it'd be worth it since it needs to be converted anyway? |
trevnorris commented Jan 27, 2017
@mscdex What I mean is that because of: byteOffset=+byteOffset;// Coerce to Number.we can use the more strict |
mscdex commented Jan 28, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@trevnorris The |
trevnorris commented Feb 10, 2017
@mscdex Hm. Seems the code was updated to use |
Trott commented Apr 14, 2017
#12286 seems to duplicate this and include some other things (a benchmark file, a comment explaining why it's doing things this way, and implementing the same change where |
Checklist
make -j4 test(UNIX), orvcbuild test nosign(Windows) passesAffected core subsystem(s)
buffer
Description of change
We are currently analyzing the buffer-indexof performance and noticed that a
considerable amount of time is spent in the isNan() function.
By postponing the isNan check we noticed a performance boost.
Signed-off-by: Adrian Nițu [email protected]