Skip to content
A very fast and simple JavaScript priority queue
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.travis.yml
LICENSE organize the repo more, remove esm Apr 6, 2018
README.md
bench.mjs add badge, fix benchmark Oct 10, 2018
index.mjs inline up/down for smaller code Oct 10, 2018
package.json
rollup.config.js
test.mjs

README.md

flatqueue Build Status

A very fast binary heap priority queue in JavaScript. Similar to tinyqueue, but stores the queue as two flat arrays of item ids and their numeric priority values respectively (without a way to specify a comparator function). This makes the queue more limited, but several times faster.

const q = new FlatQueue();

for (let i = 0; i < items.length; i++) {
    q.push(i, items[i].value); // push an item by passing its id and value
}

q.peekValue(); // top item value
q.peek(); // top item index
q.pop(); // remove and return the top item index
You can’t perform that action at this time.