
18 Jun
2007
18 Jun
'07
9 a.m.
Isaac Dupree wrote:
I was thinking, since we have a copying garbage collector that reassigns all pointers anyway, could we detect the "identical" heap objects and for each set of identical ones, have all thunks that pointed to any of them, now point to the single one that is created in the target space?
I think what you're proposing is often called "hash consing", except that hash-consing is usually done at construction time, you want to do it at GC time. My take is it would only be worthwhile if there was a *lot* of sharing to be gained by doing it, and in most cases there wouldn't be. This is just a guess based on my experience poking around in the heap though - feel free to try it out and prove me wrong :-) Cheers, Simon