Skip to content

Commit 1dc23b8

Browse files
committed
benchmark: calibrate util.priority-queue
According to nodejs/performance#186 this benchmark takes 0.04 minute to run a single run. So using calibrate-n script it suggests reduce it from 1e5 to 100
1 parent e8bf05f commit 1dc23b8

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

benchmark/util/priority-queue.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22

33
const common = require('../common');
44

5-
const bench = common.createBenchmark(main, {
6-
n: [1e5],
7-
}, { flags: ['--expose-internals'] });
5+
const bench = common.createBenchmark(
6+
main,
7+
{
8+
n: [100],
9+
},
10+
{ flags: ['--expose-internals'] },
11+
);
812

9-
function main({ n, type }) {
13+
function main({ n }) {
1014
const PriorityQueue = require('internal/priority_queue');
1115
const queue = new PriorityQueue();
1216
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+
for (let i = 0; i < n; i++) queue.insert((Math.random() * 1e7) | 0);
18+
for (let i = 0; i < n; i++) queue.shift();
1719
bench.end(n);
1820
}

0 commit comments

Comments
 (0)