-
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
src: simplify loop arithmetic in GetCPUInfo
#26183
Closed
Closed
Conversation
This file contains 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
Cache the repeated operations and reuse; potentially generating efficient code in some platforms, and improving readability.
nodejs-github-bot
added
c++
Issues and PRs that require attention from people who are familiar with C++.
os
Issues and PRs related to the os subsystem.
labels
Feb 18, 2019
mscdex
reviewed
Feb 18, 2019
richardlau
reviewed
Feb 19, 2019
richardlau
approved these changes
Feb 19, 2019
BridgeAR
approved these changes
Feb 19, 2019
ZYSzys
reviewed
Feb 19, 2019
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.
Since we are here, how about do the same thing on js land too for consistency ?
Lines 88 to 106 in 8375c70
function cpus() { | |
// [] is a bugfix for a regression introduced in 51cea61 | |
const data = getCPUs() || []; | |
const result = []; | |
for (var i = 0; i < data.length; i += 7) { | |
result.push({ | |
model: data[i], | |
speed: data[i + 1], | |
times: { | |
user: data[i + 2], | |
nice: data[i + 3], | |
sys: data[i + 4], | |
idle: data[i + 5], | |
irq: data[i + 6] | |
} | |
}); | |
} | |
return result; | |
} |
@ZYSzys - done, thanks! |
ZYSzys
reviewed
Feb 19, 2019
BridgeAR
reviewed
Feb 19, 2019
ZYSzys
approved these changes
Feb 19, 2019
apapirovski
approved these changes
Feb 20, 2019
jasnell
approved these changes
Feb 21, 2019
Landed in e51da1f. |
danbev
pushed a commit
that referenced
this pull request
Feb 21, 2019
Cache the repeated operations and reuse; potentially generating efficient code in some platforms, and improving readability. PR-URL: #26183 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax
pushed a commit
that referenced
this pull request
Feb 21, 2019
Cache the repeated operations and reuse; potentially generating efficient code in some platforms, and improving readability. PR-URL: #26183 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Merged
rvagg
pushed a commit
that referenced
this pull request
Feb 28, 2019
Cache the repeated operations and reuse; potentially generating efficient code in some platforms, and improving readability. PR-URL: #26183 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com>
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.
Cache the repeated operations and reuse; potentially generating
efficient code in some platforms, and improving readability.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes