[Haskell-cafe] Foreign function performance: monadic vs pure
Serguei Son
serguei.son at gmail.com
Mon Apr 11 16:18:35 CEST 2011
Serguei Son <serguei.son <at> gmail.com> writes:
> Also, please note that I can force the evaluation
> of c_sin, e.g.
>
> mapM (return . c_sin) [1..n] >>= (print $ foldl' (+) 0)
>
> And it will still execute reasonably fast.
>
Pls disregard the my previous post. I actually meant
let lst = map c_sin [1..n]
print $ foldl' (+) 0 lst
This executes in 0.2 s for n = 10^7. c_sin is safe, as well
as c_sin_m. The only difference is CDouble -> CDouble vs
CDouble -> IO CDouble.
More information about the Haskell-Cafe
mailing list