summaryrefslogtreecommitdiff
path: root/deps/node/benchmark/misc/freelist.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/node/benchmark/misc/freelist.js')
-rw-r--r--deps/node/benchmark/misc/freelist.js38
1 files changed, 0 insertions, 38 deletions
diff --git a/deps/node/benchmark/misc/freelist.js b/deps/node/benchmark/misc/freelist.js
deleted file mode 100644
index 7fa9af4f..00000000
--- a/deps/node/benchmark/misc/freelist.js
+++ /dev/null
@@ -1,38 +0,0 @@
-'use strict';
-
-const common = require('../common.js');
-
-const bench = common.createBenchmark(main, {
- n: [100000]
-}, {
- flags: ['--expose-internals']
-});
-
-function main({ n }) {
- const { FreeList } = require('internal/freelist');
- const poolSize = 1000;
- const list = new FreeList('test', poolSize, Object);
- var j;
- const used = [];
-
- // First, alloc `poolSize` items
- for (j = 0; j < poolSize; j++) {
- used.push(list.alloc());
- }
-
- bench.start();
-
- for (var i = 0; i < n; i++) {
- // Return all the items to the pool
- for (j = 0; j < poolSize; j++) {
- list.free(used[j]);
- }
-
- // Re-alloc from pool
- for (j = 0; j < poolSize; j++) {
- list.alloc();
- }
- }
-
- bench.end(n);
-}