Raphael Collet writes: > David Hopwood wrote: > > Raphael Collet wrote: > >> David Hopwood wrote: > >> > >>> Hmm. I believe the following optimization is worth considering: when two > >>> variables are either bound together or successfully tested for structural > >>> equality, set both to point to the structure with the lower address. > >>> > >>> (Note that this only incurs extra overhead in the slow path where the > >>> full unification or structural equality algorithms are needed, not in the > >>> fast paths where they either already have the same address, or one was > >>> unbound.) > >> Your suggestion implies that the memory representation of a record could > >> be turned into an indirection to another representation of the same > >> record. > > > > I explained this poorly. The intent was that no extra indirections are > > added; > > the optimization only applies to cases where there is already an > > indirection. > > Please read carefully my former reply: > http://www.mozart-oz.org/pipermail/mozart-users/2006/014360.html > > I checked Mozart's unification procedure, and the "optimization" is > possible. A few nontrivial modifications are necessary, though. But I > am still not convinced it is worth the effort. >
Yes, as Raph said, we can overwrite one of the structures with an indirection to the other. I, too, doubt it will have an impact on real programs but since it is so cheap it would be worth adding. So, if someone wants to implement it and try it out that would be great. It will need a lot of testing and/or code inspection to be sure it is safe. It would change the current behaviour of System.eq (I hesitate to say System.eq has a semantics!) but any programs broken by that deserve to be ... If someone does implement it they can be given CVS write access or send a patch and someone will add it to CVS on their behalf. Indeed, we encourage people to start working on Mozart, there are lots of nice things that can be done. cheers k _________________________________________________________________________________ mozart-users mailing list [email protected] http://www.mozart-oz.org/mailman/listinfo/mozart-users
