diff options
author | Brian White <mscdex@mscdex.net> | 2017-02-25 23:40:39 -0500 |
---|---|---|
committer | Brian White <mscdex@mscdex.net> | 2017-03-02 15:31:21 -0500 |
commit | 4e05952a8a75af6df625415db612d3a9a1322682 (patch) | |
tree | 0ae32c1f3c65cb506effdfcfd0a5a75dce1b7586 /benchmark | |
parent | 22d7dc221211678dd1d5ce30d298791df7dfd956 (diff) | |
download | android-node-v8-4e05952a8a75af6df625415db612d3a9a1322682.tar.gz android-node-v8-4e05952a8a75af6df625415db612d3a9a1322682.tar.bz2 android-node-v8-4e05952a8a75af6df625415db612d3a9a1322682.zip |
os: improve cpus() performance
PR-URL: https://github.com/nodejs/node/pull/11564
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jackson Tian <shyvo1987@gmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/os/cpus.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/benchmark/os/cpus.js b/benchmark/os/cpus.js new file mode 100644 index 0000000000..2a8535113c --- /dev/null +++ b/benchmark/os/cpus.js @@ -0,0 +1,17 @@ +'use strict'; + +const common = require('../common.js'); +const cpus = require('os').cpus; + +const bench = common.createBenchmark(main, { + n: [3e4] +}); + +function main(conf) { + const n = +conf.n; + + bench.start(); + for (var i = 0; i < n; ++i) + cpus(); + bench.end(n); +} |