diff --git a/benchmark/util/priority-queue.js b/benchmark/util/priority-queue.js index ea4601a0021b9a..7209f66782be3e 100644 --- a/benchmark/util/priority-queue.js +++ b/benchmark/util/priority-queue.js @@ -3,10 +3,10 @@ const common = require('../common'); const bench = common.createBenchmark(main, { - n: [1e5] + n: [1e6] }, { flags: ['--expose-internals'] }); -function main({ n, type }) { +function main({ n }) { const PriorityQueue = require('internal/priority_queue'); const queue = new PriorityQueue(); bench.start(); diff --git a/lib/internal/priority_queue.js b/lib/internal/priority_queue.js index 22f89a90ef07f1..6824e920a42e0d 100644 --- a/lib/internal/priority_queue.js +++ b/lib/internal/priority_queue.js @@ -11,7 +11,7 @@ const { // just a single criteria. module.exports = class PriorityQueue { - #compare = (a, b) => a - b; + #compare = (a, b) => (a > b ? 1 : a < b ? -1 : 0); #heap = new Array(64); #setPosition; #size = 0;