A very fast JavaScript priority queue implemented with a binary heap using parallel typed arrays. Version 1.0.2 is stable with no dependencies, released by luciopaiva. Benchmarks show it outperforms competitors like TinyQueue, FastPQ, FlatQueue, and Closure Library in push, pop, and interleaved operations. Supports min-heap, custom capacity, and various key/priority types. Ships TypeScript types and is available for Node.js (ESM and CJS) and browsers (global script or ESM). Suitable for performance-critical applications requiring low-latency queue operations.
npm install heapifyNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates core operations: create MinQueue, push with priority, pop min, peek, peekPriority, clear, and empty queue behavior.
Avoid mixing pop() and peek() without a push() in between if O(1) peeking is critical.
Specify expected capacity in constructor: new MinQueue(initialCapacity).
For max-queue, use a negative priority or implement a wrapper.
Use integer priorities and ensure keys are compatible with Uint32Array or Float64Array.
Use const { MinQueue } = require('heapify'); instead of const MinQueue = require('heapify');Use const { MinQueue } = require('heapify'); for CommonJS.Ensure you have installed heapify (npm install heapify) and that tsconfig.json includes node_modules types.
Use import { MinQueue } from 'heapify' (ESM) or const { MinQueue } = require('heapify') (CJS).Reduce initial capacity or increase available memory. Capacity must be a positive integer.
No dependency data recorded yet.