summaryrefslogtreecommitdiff
path: root/deps/node/benchmark/async_hooks/gc-tracking.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/node/benchmark/async_hooks/gc-tracking.js')
-rw-r--r--deps/node/benchmark/async_hooks/gc-tracking.js44
1 files changed, 0 insertions, 44 deletions
diff --git a/deps/node/benchmark/async_hooks/gc-tracking.js b/deps/node/benchmark/async_hooks/gc-tracking.js
deleted file mode 100644
index d74b2bac..00000000
--- a/deps/node/benchmark/async_hooks/gc-tracking.js
+++ /dev/null
@@ -1,44 +0,0 @@
-'use strict';
-const common = require('../common.js');
-const { AsyncResource } = require('async_hooks');
-
-const bench = common.createBenchmark(main, {
- n: [1e6],
- method: [
- 'trackingEnabled',
- 'trackingDisabled',
- ]
-}, {
- flags: ['--expose-gc']
-});
-
-function endAfterGC(n) {
- setImmediate(() => {
- global.gc();
- setImmediate(() => {
- bench.end(n);
- });
- });
-}
-
-function main({ n, method }) {
- var i;
- switch (method) {
- case 'trackingEnabled':
- bench.start();
- for (i = 0; i < n; i++) {
- new AsyncResource('foobar');
- }
- endAfterGC(n);
- break;
- case 'trackingDisabled':
- bench.start();
- for (i = 0; i < n; i++) {
- new AsyncResource('foobar', { requireManualDestroy: true });
- }
- endAfterGC(n);
- break;
- default:
- throw new Error(`Unsupported method "${method}"`);
- }
-}