• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4
5const bench = common.createBenchmark(main, {
6  n: [1e5],
7}, { flags: ['--expose-internals'] });
8
9function main({ n, type }) {
10  const PriorityQueue = require('internal/priority_queue');
11  const queue = new PriorityQueue();
12  bench.start();
13  for (let i = 0; i < n; i++)
14    queue.insert(Math.random() * 1e7 | 0);
15  for (let i = 0; i < n; i++)
16    queue.shift();
17  bench.end(n);
18}
19