From bed4612c408dddd86f82b0d939338b6b72a5e346 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Wed, 26 Apr 2017 16:47:43 -0700 Subject: [PATCH] benchmark: add benchmark for v8.getHeap*Statistics PR-URL: https://github.com/nodejs/node/pull/12681 Reviewed-By: Vse Mozhet Byt --- benchmark/v8/get-stats.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 benchmark/v8/get-stats.js diff --git a/benchmark/v8/get-stats.js b/benchmark/v8/get-stats.js new file mode 100644 index 0000000000..34d52d039f --- /dev/null +++ b/benchmark/v8/get-stats.js @@ -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); +}