== Quote from Andrei Alexandrescu ([email protected])'s article
> > Of course, we could get even fancier.  We could recursively introspect 
> > struct
> > types and use various heuristics to calculate the optimal comparison order 
> > at
> > compile time.  Similar stuff could be done for a generic opCmp that gives a
> > struct an arbitrary total ordering as long as all of its members have a 
> > total
> > ordering.
> This can be done if you associate a cost with each operation (e.g.
> comparing numbers has cost 1, comparing strings has cost 10, comparing
> using a user-defined function has cost 40 etc.) and then optimize for
> smallest average cost.
> Andrei

Right, this is what I had in mind.  I take it this isn't a common, well-known
optimization technique already?  Walter?

Reply via email to