Dilemma: DiffArray non-performance vs STArray non-readability

Don Stewart dons at galois.com
Mon Oct 27 14:12:19 EDT 2008

> I keep wanting to use DiffArray as the natural functional solution to
> single-threaded array use. But everytime I try, I get smacked over
> the head with the actual performance figures. Sometimes, even plain
> arrays are faster in a loop doing array updates, in spite of all the 
> copying involved. And when copying on update dominates the runtime, 
> using IntMap tends to be faster - the "indirections" are the wrong way
> round, but don't pile up, just that array lookups aren't quite constant
> time.

In my view, DiffArray needs a modern rewrite. There's no need for it to
be as slow as it is. We played with some similar structures at work, and
got quite good performance, so I think the problem is not fundamental.

Time for someone to step up and write a new fast diff array.

-- Don

More information about the Glasgow-haskell-users mailing list