
On Thu, Mar 08, 2007 at 04:32:01PM -0500, Brandon S. Allbery KF8NH wrote:
On Mar 8, 2007, at 16:27 , David Roundy wrote:
The real issue for me is that DiffArrays only make any sense at all if you often update a subset of your array, which I never expect to do... so even if they were efficiently implemented to the point of zero overhead, they would gain me nothing, and that's almost certainly overly optimistic.
But that's not my understanding of what's *supposed* to be happening: the point of DiffArrays is is not optimizing partial updates, it's optimizing the head at the expense of any (by intent few or none) references that might be held elsewhere. As such, if there are no such references the DiffArray *should* get you cheap in- place (destructive) updates.
Ah, I see. Yes, I misunderstood. When I read about DiffArrays (ages ago), I thought they stored the old array plus differences, a mistake which makes sense given that I wasn't yet comfortable with safe encapsulation of unsafePerformIO. You're right, but the cheap destructive updates still presumably involve creating and garbage-collecting O(N) thunks, which isn't particularly cheap, in my opinion. Or if the update function holds a reference to the original array, then you'll have to store two copies of the array in a non-dense format, and we won't have gained anything, as far as the temporary goes. -- David Roundy Department of Physics Oregon State University