use unordered-containers instead of hashmap? #13

cartazio opened this Issue Feb 20, 2012 · 5 comments


None yet
3 participants

it seems that unordered-containers is the current "blessed" hashmap package, and "unordered-containers" and "hashmap" have overlapping module names. It might just be a change in imports to make it work.


colah commented Feb 20, 2012

Interesting. Right now performance concerns don't seem to centre on the language interpreter part of extopenscad... My profiling shows the real expenses to be the Export stuff. Still, I'm definitely interested in playing around with this.

Do you know if this will cause issues if one simultaneously installs with something depending on hashmap?

colah was assigned Feb 20, 2012

if you're always using cabal to build (i think, but certainly a nonissue if you're always using cabal-dev, capri or the like), it doesn't matter,
but if you're just doing ghci main.hs, if two modules from different packages have the same name (in this case it'd be Data.HashSet ), well, you then have to uninstall one of them, OR cabalize your code.

if you want to easily play with the two, maybe you could use

ghc-pkg hide hashmap
stuff with unordered
ghc-pkg expose hashmap
or something like that.

let me clarify: if you mean "how can i try this out, but without getting bogged down in having to reinstall everything later",
i'd say use cabal dev to create a local clean folder


or one of the similar tools.

Am I answering your question correctly?

Its also worth adding that the hashmap package has some nasty space leaks because of laziness if you're doing a long sequence of inserts before doing lookups that force the computations. In contrast, the unordered-containers hashmaps have both lazy and strict implementations of the data structures. to whit, i my use case, ~ 8 million insertWith/update operations having a blowup to needing ~ 45gb of ram with the hashmap package and taking ~ 2+ hours to complete vs < 1.5gb and finishing in less than 5 minutes. You're likely not doing anything that complex with Implicit as yet, but come huge #'s of ops, you'll start to hurt.


bgamari commented Nov 24, 2012

Pull request #71 moved things to unordered-containers. This can be closed now.

colah closed this Dec 19, 2012


colah commented Dec 19, 2012

I really should have done this a lot earlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment