psqueues

Pure priority search queues

Version on this page:0.2.2.3
LTS Haskell 9.9:0.2.4.0
Stackage Nightly 2017-10-20:0.2.4.0
Latest on Hackage:0.2.4.0
BSD3 licensed
Maintained by Jasper Van der Jeugt

Module documentation for 0.2.2.3

The psqueues package provides Priority Search Queues in three different flavors.

  • OrdPSQ k p v, which uses the Ord k instance to provide fast insertion, deletion and lookup. This implementation is based on Ralf Hinze's A Simple Implementation Technique for Priority Search Queues. Hence, it is similar to the PSQueue library, although it is considerably faster and provides a slightly different API.

  • IntPSQ p v is a far more efficient implementation. It fixes the key type to Int and uses a radix tree (like IntMap) with an additional min-heap property.

  • HashPSQ k p v is a fairly straightforward extension of IntPSQ: it simply uses the keys' hashes as indices in the IntPSQ. If there are any hash collisions, it uses an OrdPSQ to resolve those. The performance of this implementation is comparable to that of IntPSQ, but it is more widely applicable since the keys are not restricted to Int, but rather to any Hashable datatype.

Each of the three implementations provides the same API, so they can be used interchangeably. The benchmarks show how they perform relative to one another, and also compared to the other Priority Search Queue implementations on Hackage: PSQueue and fingertree-psqueue.

Typical applications of Priority Search Queues include:

  • Caches, and more specifically LRU Caches;

  • Schedulers;

  • Pathfinding algorithms, such as Dijkstra's and A*.

Changes

- 0.2.4.0 (2017-09-27)
* Add `unsafeMapMonotonic`
* Lower build depends version for hashable
* Move repo to `jaspervdj/psqueues` to enable travis
* Lower build depends version for hashable

- 0.2.3.0
* Add an `atMostView` function to all PSQ flavours
* Bump HUnit dependency to 1.6
* Bump QuickCheck dependency to 2.10
* Clean up warnings on newer and older GHC versions

- 0.2.2.3
* Bump HUnit dependency to 1.5

- 0.2.2.2
* Bump QuickCheck dependency bounds

- 0.2.2.1
* Fix benchmark compilation with stack

- 0.2.2.0
* Fix import of Traversable on GHC 7.8

- 0.2.1.0
* Add Traversable instances

- 0.2.0.3
* Bump HUnit dependency bounds

- 0.2.0.2
* Bump QuickCheck dependency bounds

- 0.2.0.1
* Minor documentation fixes

- 0.2.0.0
* Add convenience `deleteMin` function
* Bump `deepseq` dependency to 1.4

- 0.1.1.0
* Remove constraints from `size`

- 0.1.0.1
* Extend cabal description, include CHANGELOG

- 0.1.0.0
* First release: <https://medium.com/@bttr/announcing-psqueues-8a0fe9fe939>
comments powered byDisqus