summaryrefslogtreecommitdiff
path: root/benchmark/v8/get-stats.js
blob: 21c6efb2f8588d94bca40f5f2eb72a7cb020646a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';

const common = require('../common.js');
const v8 = require('v8');

const bench = common.createBenchmark(main, {
  method: [
    'getHeapStatistics',
    'getHeapSpaceStatistics',
  ],
  n: [1e6],
});

function main({ method, n }) {
  bench.start();
  for (let i = 0; i < n; i++)
    v8[method]();
  bench.end(n);
}