On Mon, 4 Mar 2013 14:37:40 +0100 (CET) Daniël Mantione <daniel.manti...@freepascal.org> wrote:
> > > Op Mon, 4 Mar 2013, schreef Mattias Gaertner: > > > Can this be cached? > > Maybe the compiler can reuse some results? > > No. The symtable lookups can be parsed, but the candidate selection, which > I believe is actually more compute intensive, is dependend on the actual > situation where the operator is called, for example the types of the left > and right part, which would not yield very high hit rates. Why not? I guess that a high percentage are only a few type,operator,type combinations. > Originally the compiler was doing the candidate selection with a simple > loop through the parameters that took the first suitable match. When the > type conversion matters became more complex the "Unable to determine > overloaded procedure" error became increasingle annoying. > > At some point I did redesign it with scoring system: Each candidate that > is compatible gets assigned a score how well the overloaded procedure > matches the parameters. The best match is selected. > > At that point, the compiler became highly intelligent in finding the > correct overloaded procedure/operator, but the amount of computing power > involved with overloading went up: Instead of selecting the first > candidate, we need to compute the score for all candidates. This even > requires floating point arithmetic. Yes, it really helped. Nice work. I'm just wondering why these scores should be different for each operator in a unit. Mattias _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel