[Haskell-cafe] Re: memoization
John Lato
jwlato at gmail.com
Sun Sep 6 07:36:57 EDT 2009
I just discovered that changing DiffArray to a plain Array improves
performance of my code by almost a factor of 10. Bitten by DiffArray
yet again!
John
-- this is no good, just change DiffArray to Array.
> update :: (Char -> [Int]) -> DiffArray Int ModP -> Char -> DiffArray Int ModP
> update lookup arr c = arr // (map calc . lookup $ c)
> where
> calc i = (i, (arr ! i) + (arr ! (i-1)))
More information about the Haskell-Cafe
mailing list