[Haskell] Haskell fast (?) arrays

Stefan O'Rear stefanor at cox.net
Tue May 1 09:44:31 EDT 2007


On Tue, May 01, 2007 at 01:59:01PM +0200, Federico Squartini wrote:
> I was reading an old post where Hal Daume III was analyzing Haskell
> performance for arrays.
> He proposed a test program which initializes an array, reverse it a number
> of times, and sums the contents.
> 
> So I wrote a c++ reference program, a naive haskell version using lists and
> I also tweaked a little bit with the IOArray version, which should be the
> fastest. Unfortunately there is a  huge performance gap. Haskell is slower
> by a factor of ten, even when using imperative style.

I'd recommend using -O2 or -O.  GHC doesn't even try to generate fast
code if you don't use them. 

Stefan


More information about the Haskell mailing list