talira

unordered-containers

Efficient hashing-based container types for Haskell

open sourceBSD-3-Clausefree

unordered-containers is a Haskell library of hashing-based container types, HashMap and HashSet, optimised for large amounts of data and high speed. Each operation documents its cost as worst-case or amortised, and the costs hold even when structures are shared. Originally written by Johan Tibell, it is one of the most depended-on packages on Hackage and is maintained by Simon Jakobi and David Feuer under the BSD-3-Clause licence.

Problems it solves

  • a fast hash map for Haskell keys that only need Hashable, not Ord
  • speed up lookups in a big Haskell Data.Map with string keys
  • store a large set of unique values in Haskell with fast membership checks

Features

  • HashMap and HashSet
  • documented worst-case or amortised cost per operation
  • costs hold for shared persistent structures
  • tested on GHC 8.10 to 9.14

Limitations

  • Provides no defence against hash collision attacks such as HashDoS: its maintainers advise Data.Map or Data.Set from containers for keys derived from untrusted input.1

Alternatives

The same job

These do what unordered-containers does.

  1. containers Assorted concrete container types for Haskell

Compare unordered-containers with the top 3