mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
83cc1e2c8b
PR-URL: https://github.com/nodejs/node/pull/46438 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: James M Snell <jasnell@gmail.com>
19 lines
433 B
JavaScript
19 lines
433 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const bench = common.createBenchmark(main, {
|
|
n: [1e5],
|
|
}, { flags: ['--expose-internals'] });
|
|
|
|
function main({ n, type }) {
|
|
const PriorityQueue = require('internal/priority_queue');
|
|
const queue = new PriorityQueue();
|
|
bench.start();
|
|
for (let i = 0; i < n; i++)
|
|
queue.insert(Math.random() * 1e7 | 0);
|
|
for (let i = 0; i < n; i++)
|
|
queue.shift();
|
|
bench.end(n);
|
|
}
|