os: improve networkInterfaces() performance#25410
Closed
mscdex wants to merge 1 commit intonodejs:masterfrom
Closed
os: improve networkInterfaces() performance#25410mscdex wants to merge 1 commit intonodejs:masterfrom
mscdex wants to merge 1 commit intonodejs:masterfrom
Conversation
jdalton
reviewed
Jan 9, 2019
lib/os.js
Outdated
Member
There was a problem hiding this comment.
Can you explain the perf benefit for networkInterfaces()?
Member
There was a problem hiding this comment.
At first glance it looks like a lot of unrolled code with an extra object being created. Could you please step me through the optimization being done in networkInterfaces(). If you drop the rework to networkInterfaces() do you still see perf wins?
Contributor
Author
There was a problem hiding this comment.
It's more or less moving the object creation from C++ to JS land, just like we do for CPU enumeration.
BridgeAR
reviewed
Jan 9, 2019
Member
BridgeAR
left a comment
There was a problem hiding this comment.
I personally wonder if it would not be faster to just move everything to C++ instead.
The changes LGTM besides the result object. It should be kept as regular object.
jasnell
approved these changes
Jan 9, 2019
d7b7cde to
b505976
Compare
BridgeAR
approved these changes
Jan 10, 2019
Member
Contributor
|
Landed in 5021b25. |
danbev
pushed a commit
that referenced
this pull request
Jan 14, 2019
PR-URL: #25410 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
addaleax
pushed a commit
that referenced
this pull request
Jan 14, 2019
PR-URL: #25410 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Merged
BridgeAR
pushed a commit
to BridgeAR/node
that referenced
this pull request
Jan 16, 2019
PR-URL: nodejs#25410 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With included benchmark:
and also makes the C++ implementation mirror the C++ cpu enumeration code for whatever that's worth.
CI: https://ci.nodejs.org/job/node-test-pull-request/20031/
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes