"Shawn P. Garbett" <[EMAIL PROTECTED]> wrote, > I redid both programs to make them equivalent in action. The haskell program > was not actually summing the results, the C program was not checking array > bounds (Haskell does), the C program did not initialize the array and the C > program didn't print the result. > > Times on my laptop (Crusoe 933): > > 62.061s : Haskell (Array -O2) Note: lot's 'o disk grinding! > 18.231s : Haskell (UArray -O2) > 18.108s : Haskell (UArray -O2 -fvia-c) > 17.443s : Haskell (UArray -O2 -funfolding-update-in-place) > 0.807s : C (-O3 without bound check) > 1.127s : C (-O3 with bound check) > > At best case for Haskell, 15.5 times slower. The thing about bounds checking, > in Haskell it's always there. In C, you might have it, you might not there is > no certainty by the language, only by design and implementation. So with C, > one is free to live dangerously.
The first two sections of http://www.cse.unsw.edu.au/~chak/papers/CK03.html also contain an analysis of some of the overheads in Haskell array codes compiled with GHC. Cheers, Manuel _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
