[Haskell-cafe] speed of hashing
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...
More information about the Haskell-Cafe