summaryrefslogtreecommitdiff
path: root/benchmark/v8
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2017-04-26 16:47:43 -0700
committerJames M Snell <jasnell@gmail.com>2017-04-28 14:29:33 -0700
commitbed4612c408dddd86f82b0d939338b6b72a5e346 (patch)
tree9163a91dec73ee9c7ed1718277cffdecf263220a /benchmark/v8
parentdeb9622b11a2780f35e5d122273abcf6458bbe4b (diff)
downloadandroid-node-v8-bed4612c408dddd86f82b0d939338b6b72a5e346.tar.gz
android-node-v8-bed4612c408dddd86f82b0d939338b6b72a5e346.tar.bz2
android-node-v8-bed4612c408dddd86f82b0d939338b6b72a5e346.zip
benchmark: add benchmark for v8.getHeap*Statistics
PR-URL: https://github.com/nodejs/node/pull/12681 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Diffstat (limited to 'benchmark/v8')
-rw-r--r--benchmark/v8/get-stats.js23
1 files changed, 23 insertions, 0 deletions
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);
+}