[Haskell-cafe] Re: Go Haskell!

Claus Reinke claus.reinke at talk21.com
Thu Nov 27 16:20:20 EST 2008

>> What do those folks working on parallel Haskell arrays think about the
>> sequential Haskell array baseline performance?
> Try using a fast array library like uvector? (With no serious overhead for
> tuples too, fwiw)...

I downloaded uvector a while ago, but haven't got round to trying it
(yet another array API?). Mostly, I'd like to know a little more than just 
"fast array lib":

- in which ways is it supposed to be faster? why?
- for which usage patterns is it optimised? how?
- if it is faster in general, why hasn't it replaced the default arrays?

In general, I think Haskell has too many array libraries, with too
many APIs. And that doesn't even take account the overuse of
unsafe APIs, or the non-integrated type-level safety tricks - if 
array accesses were properly optimized, there should be a lot 
less need for the extreme all-or-nothing checks or home-grown
alternative special-purpose APIs:

- type-level code for watermarking indices belonging to certain 
    index sets is one step to eliminate index checks, but hasn't been
    integrated into any of the standard libs
- one could also associate index subsets with operations that do 
    not leave the index superset belonging to an array (eg, if 
    min<i<max, then min<=i+-1<=max, still safe without checks)
- GHC does seem to common up index checks only if they are
    identical, but if min<i<i+1<i+2<..<i+j<max, only the outer checks 
    are really necessary (as long as we know about '+')
- whole-array ops allow to avoid index checks without type-level
    tricks, leaving the indexing implicit; but the corresponding ops
    in Data.Array.MArray claim to construct new arrays, contrary
    to the intended inplace updating for which one uses MArrays?
- etc. etc.

At least, uvector seems to take multi-element ops more seriously.
But with so many people working on sequential and parallel Haskell
array libraries, I was hoping for someone to take a big ax and clear
out all that sick and half-dead wood, to give a small number of healthy 
arrays libs room to grow. Would be a lot easier for us poor naive
Haskell array users who otherwise tend to get lost in that forrest!-)

Just my 2c,-)

More information about the Haskell-Cafe mailing list