[Haskell-cafe] speed of hashing

Dennis Raddle dennis.raddle at gmail.com
Tue Jul 4 02:09:25 UTC 2017

Hello, I have an application which could benefit from caching certain
computations. For instance, I might have a function:

listToWord :: [Int] -> Word16

which takes an integer X in the input as referring to bit X in the output
word, and sets the bits.

I have to run this computation many times within the inner loop. So I
thought I could cache it. The only trouble is that it may not be any less
expensive to convert the [Int] into a hash value, or use it as a key to
look up a binary Map.

What do you think? Does Haskell hashing use some kind of optimized
computation that's faster than me writing a loop by hand?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170703/4bd984cb/attachment.html>

More information about the Haskell-Cafe mailing list