benchmark: add benchmark for v8.getHeap*Statistics
PR-URL: https://github.com/nodejs/node/pull/12681 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
This commit is contained in:
parent
deb9622b11
commit
bed4612c40
23
benchmark/v8/get-stats.js
Normal file
23
benchmark/v8/get-stats.js
Normal file
@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
const common = require('../common.js');
|
||||
const v8 = require('v8');
|
||||
|
||||
const bench = common.createBenchmark(main, {
|
||||
method: [
|
||||
'getHeapStatistics',
|
||||
'getHeapSpaceStatistics'
|
||||
],
|
||||
n: [1e6],
|
||||
flags: ['--ignition --turbo', '']
|
||||
});
|
||||
|
||||
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);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user