We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
cpus
1 parent cc7018e commit 2c09633Copy full SHA for 2c09633
lib/os.js
@@ -22,6 +22,7 @@
22
'use strict';
23
24
const {
25
+ Array,
26
ArrayPrototypePush,
27
Float64Array,
28
NumberParseInt,
@@ -140,10 +141,12 @@ function loadavg() {
140
141
function cpus() {
142
// [] is a bugfix for a regression introduced in 51cea61
143
const data = getCPUs() || [];
- const result = [];
144
+ const result = new Array(data.length / 7);
145
let i = 0;
146
+ let resultIndex = 0;
147
+
148
while (i < data.length) {
- ArrayPrototypePush(result, {
149
+ result[resultIndex++] = {
150
model: data[i++],
151
speed: data[i++],
152
times: {
@@ -153,7 +156,7 @@ function cpus() {
153
156
idle: data[i++],
154
157
irq: data[i++],
155
158
},
- });
159
+ };
160
}
161
return result;
162
0 commit comments