0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 23:16:30 +01:00
nodejs/benchmark/os/loadavg.js
Brian White efdc571a58
os: improve loadavg() performance
PR-URL: https://github.com/nodejs/node/pull/11516
Reviewed-By: Jackson Tian <shyvo1987@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-02-25 20:53:56 -05:00

18 lines
280 B
JavaScript

'use strict';
const common = require('../common.js');
const loadavg = require('os').loadavg;
const bench = common.createBenchmark(main, {
n: [5e6]
});
function main(conf) {
const n = +conf.n;
bench.start();
for (var i = 0; i < n; ++i)
loadavg();
bench.end(n);
}