0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 23:16:30 +01:00
nodejs/benchmark/v8/get-stats.js
James M Snell 1052383f7c v8: refactor struture of v8 module
Use the more efficient module.exports = {} pattern,
restructure imports from bindings, requires.

PR-URL: https://github.com/nodejs/node/pull/12681
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2017-04-28 14:29:45 -07:00

23 lines
374 B
JavaScript

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