Re: [Haskell] Haskell fast (?) arrays

2007-05-02 Thread Simon Marlow
Federico Squartini wrote: Thanks for the hints. It's a pity that (as far as I know) no one has written a tutorial on those techniques, because I think it would be appreciated. Some of them are quite involved and learning them just by reading code is very time consuming. There's the Performance

Re: [Haskell] Haskell fast (?) arrays

2007-05-01 Thread Axel Simon
Frederico, On Tue, 2007-05-01 at 13:59 +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++

Re: [Haskell] Haskell fast (?) arrays

2007-05-01 Thread Stefan O'Rear
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++

Re: [Haskell] Haskell fast (?) arrays

2007-05-01 Thread Federico Squartini
Of course I know that the list version is very unfair, but I wanted to see what was the trade off between elegance and speed. Regarding whether low level programming makes sense or not, I was just curious to see what are the limits of Haskell. Moreover there is not much literature on high

Re: [Haskell] Haskell fast (?) arrays

2007-05-01 Thread Donald Bruce Stewart
federico.squartini: Of course I know that the list version is very unfair, but I wanted to see what was the trade off between elegance and speed. Regarding whether low level programming makes sense or not, I was just curious to see what are the limits of Haskell. Moreover

Re: [Haskell] Haskell fast (?) arrays

2007-05-01 Thread Federico Squartini
Sorry, I was very silly! This is the correct version of the program using the doFromto loop. And it runs fast! I hope there are no further mistakes. Thanks Axel. time ./IOMutUnbUnsafe 499 real0m0.708s user0m0.573s sys 0m0.008s

Re: [Haskell] Haskell fast (?) arrays

2007-05-01 Thread Federico Squartini
Thanks for the hints. It's a pity that (as far as I know) no one has written a tutorial on those techniques, because I think it would be appreciated. Some of them are quite involved and learning them just by reading code is very time consuming. Federico

Re: [Haskell] Haskell fast (?) arrays

2007-05-01 Thread Rishiyur Nikhil
I think another interesting data point would be for a C++ version that uses the 'vector' data type from STL (Standard Template Library) and using the vector indexing ops that do bounds-checking. Regards, Nikhil ___ Haskell mailing list

Re: [Haskell] Haskell fast (?) arrays

2007-05-01 Thread Taral
On 5/1/07, Federico Squartini [EMAIL PROTECTED] wrote: Thanks for the hints. It's a pity that (as far as I know) no one has written a tutorial on those techniques, because I think it would be appreciated. Some of them are quite involved and learning them just by reading code is very time

Re: [Haskell] Haskell fast (?) arrays

2007-05-01 Thread Bas van Dijk
On 5/1/07, Federico Squartini [EMAIL PROTECTED] wrote: Moreover there is not much literature on high performance Haskell programming (tricks like unsafeWrite), at least organized in a systematic and concise way. Look at: http://haskell.org/haskellwiki/Performance regards, Bas van Dijk

Re: [Haskell] Haskell fast (?) arrays

2007-05-01 Thread Stephan Herhut
While scanning my Inbox I read 'fast' and 'array' in the context of functional programming. Well, of course SaC instantly came to my mind (what a surprise ;) ). So I did some measurements myself. I used your programs, except that I increased the array size by a factor of 10. For the C++ version I

Re: [Haskell] Haskell fast (?) arrays

2007-05-01 Thread Donald Bruce Stewart
federico.squartini: Sorry, I was very silly! This is the correct version of the program using the doFromto loop. And it runs fast! I hope there are no further mistakes. Thanks Axel. time ./IOMutUnbUnsafe 499 real 0m0.708s user 0m0.573s sys 0m0.008s Here's an improved version,