[Haskell-cafe] Haskell performance question
Dan Piponi
dpiponi at gmail.com
Thu Nov 8 14:28:34 EST 2007
Mikhail,
> main = do
> print $ foldl' (+) 0 $ take 100000000 [1.0,1.0..]
>
> works 10 times faster than your C version. You just need to adapt to the
> radically different style of programming.
My wasn't intended to represent the problem that I'm trying to solve,
but the approach I want to take. The problems that I do want to solve
don't lend themselves to this kind of approach.
My real situation is that I want to write code that has both a
high-level component and a low-level number-crunching component that
works on large dense and sparse arrays. Idiomatic Haskell is great for
the high-level component. But the question is whether or not its worth
trying to write the low-level code in Haskell or whether I should just
write that code in C and use the FFI. There are still advantages to
using Haskell even if the code is highly unidiomatic: you have the
freedom of throwing in higher order functions from time to time in the
low-level code, and writing mixed-language code is a pain.
--
Dan
More information about the Haskell-Cafe
mailing list