[Haskell-cafe] Matrices in Haskell

Claus Reinke claus.reinke at talk21.com
Tue Mar 20 07:55:39 EDT 2007


> When you tried using Arrays, I presume you used an array indexed by a
> pair (i,j), and just reversed the order of the index pair to switch from
> row-wise to column-wise access? It's hard to see how that would slow you
> down. Perhaps the slowdown was caused by excessive array copying?

the difference can be in locality wrt the memory hierarchy: is the next element
nearby most of the time (apart from array borders), or a row-/column-width 
away most of the time?

i understand that, eg, fortran and c differ in their default interpretations of array 
layout, so naively translated benchmarks might suffer from running against the 
grain in one of the two (row-major loops over a column-major layout, or the
other way round).

claus



More information about the Haskell-Cafe mailing list