FiniteMap performance WITHOUT any copying?
Magnus Lindberg
f98mali@dd.chalmers.se
Sat, 8 Feb 2003 11:53:42 +0100 (MET)
Hello again and thanks for your answers, Daan an Mieszko.
Now, Haskell has a garbage collector, so Haskell must know how many
pointers there are to all objects in the heap (or?). Then, if a finite map
for example only has one single pointer to it, then it ought to be all
right to modify the finite map (or whatever datastructure we are
considering), I mean really modify the map without making any copies, just
like in imperative languages. Perhaps there might be pointers to nodes
inside the tree and I guess that could complicate the matter somewhat. But
for Haskell arrays it ought to be possible to really modify the array if
it is used by only one pointer ?
Are such optimizations possible, and if they are, are they already
implemented in for example GHC ? Or am I wrong somewhere ?
Best regards,
Magnus Lindberg