Arrays and arrays

Hal Daume III hdaume@ISI.EDU
Wed, 22 Jan 2003 07:42:37 -0800 (PST)


> All right, but why?  It seems an obvious trick, take some pieces that
> benefit from imperative processing, and wrap them in ST, leaving the
> rest of the program as it were.

Because the reason for your terrible performance is that arrays are being
copied willy nilly :).  In order to avoid this and to get in-place update
(which is what you wanted originally, iirc), you need to do all your
modifications inside the ST or IO monad.

> Can you (or anybody else) explain the memory behaviour I see (using
> hundreds of megabytes, but only tens of K visible in the profiling
> output)? 

I cannot :).  If your program is short and I can take a look at it, I
might be able to say something though....

 - Hal