[Haskell-cafe] ANN: unordered-containers - a new, faster hashing-based containers library

Johan Tibell johan.tibell at gmail.com
Wed Feb 23 17:03:51 CET 2011

Thanks for the examples. Point 3 is interesting but most of the gain
there could probably be had by telling the user to use (bigmap `union`
smallmap). My guess is that the user has a good idea which argument is

On Wed, Feb 23, 2011 at 12:45 AM, Max Bolingbroke
<batterseapower at hotmail.com> wrote:
> Personally I don't find any of these *particularly* compelling. But a
> ~6% slowdown for this functionality is not too bad - have you had a
> chance to look at the core to see if the cause of the slowdown
> manifests itself at that level? Perhaps it is possible to tweak the
> code to make this cheaper.

I did look at the core for

    test :: HashMap Int Int -> HashMap Int Int
    test hm = insert 42 12 hm

And I didn't see anything that looked particularly bad. The core uses
unboxed values everywhere possible and the recursive function (i.e.
inserts) returns an unboxed pair (# Int#, Tree k v #). The code for
O(1) size i here:


> Also, what was the size of the collections you used in your benchmark?
> I would expect the relative cost of maintaining the size to get lower
> as you increased the size of the collection.

I tried with 2^12.


More information about the Haskell-Cafe mailing list