[mercury-users] unification and polymorphism

Simon Taylor stayl at cs.mu.OZ.AU
Thu Aug 6 10:53:54 AEST 1998


 
> I think it would be nice if there was a compiler option that
> if enabled caused the compiler to specialize unifications of
> polymorphic data types if the type was known.  The compiler has
> all the necessary information to do this specialization, the
> only reason that it is not done is that no one has implemented
> it yet.
> 
> Whether or not is should be enabled by default is another question;
> as you mention, there is a space/time trade-off here, and ideally
> the choice of whether or not to enable it on a case-by-case basis
> could be controlled be profiler feedback.  However, the first step
> should be a simple compiler option.

That's one of the things I'm working on now. (I'll do specialisation
of typeclass method calls while I'm at it).

It might also be useful to do specialisation across module boundaries
in the opposite direction to the way inter-module optimization works at
the moment. This would reduce some of the code bloat by only producing
one specialised version for each input type. Done properly in combination
with profiling information this could give a significant speed-up on the
compiler, given the cost of the polymorphic compare/3 calls in map__lookup.
But that would be a bit more work.

Simon.




More information about the users mailing list