
3 Jul
2017
3 Jul
'17
10:09 p.m.
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? D