Re: readArray is faster than unsafeRead

2007-07-01 Thread Ian Lynagh
On Tue, May 29, 2007 at 02:42:22PM -0700, Scott Dillard wrote: > You're right. I broke them when experimenting to see where the cycles > were going. I've fixed them, but the other pair of functions, named > gaussElim2, were correct and the issue remains that unsafeRead appears > slower than readArr

Re: readArray is faster than unsafeRead

2007-05-30 Thread Mirko Rahn
Why would lists-of-lists be faster than unboxed arrays? No indexing arithmetic? Deforestation? I'm very curious. The first advice I got from #haskell when trying to speed up my original code was "get rid of all those lists." First, I think lists-of-lists is only faster (if at all) in your spec

Re[2]: readArray is faster than unsafeRead

2007-05-29 Thread Bulat Ziganshin
Hello Scott, Wednesday, May 30, 2007, 1:42:22 AM, you wrote: > I've included your implementation for comparison, as well as a simple > pure matrix multiplication function, but I'm having trouble tracking > them down in the profiling. I think all of their cycles are being > counted under main, but

Re: readArray is faster than unsafeRead

2007-05-29 Thread Scott Dillard
You're right. I broke them when experimenting to see where the cycles were going. I've fixed them, but the other pair of functions, named gaussElim2, were correct and the issue remains that unsafeRead appears slower than readArray. I've included your implementation for comparison, as well as a si

Re: readArray is faster than unsafeRead

2007-05-29 Thread Mirko Rahn
instead of (!) (or readArray in stateful code) helped a lot. So then I went to optimize my gaussian elimination function and found just the opposite. unsafeRead is slower than readArray. This struck me as very The functions gaussElimSafe and gaussElimUnsafe are different in their outputs (*).

RE: readArray is faster than unsafeRead

2007-05-29 Thread Simon Peyton-Jones
| Behalf Of Scott Dillard | Sent: 29 May 2007 06:22 | To: glasgow-haskell-users@haskell.org | Subject: readArray is faster than unsafeRead | | Hello, | | I'm writing some matrix multiplication and inversion functions for | small matrices (3x3 and 4x4 mostly, for 3d graphics, modeling, | simulat

readArray is faster than unsafeRead

2007-05-28 Thread Scott Dillard
Hello, I'm writing some matrix multiplication and inversion functions for small matrices (3x3 and 4x4 mostly, for 3d graphics, modeling, simulation, etc.) I noticed that the matrix multiplication was a bottleneck so I set out to optimize and found that using unsafeRead instead of (!) (or readArr