[fpc-devel] Re: Comparison FPC 2.6.2 - Kylix 3
Mattias Gaertner
nc-gaertnma at netcologne.de
Mon Mar 4 15:33:51 CET 2013
On Mon, 4 Mar 2013 15:00:30 +0100 (CET)
Daniël Mantione <daniel.mantione at freepascal.org> wrote:
>
>
> Op Mon, 4 Mar 2013, schreef Mattias Gaertner:
>
> > On Mon, 4 Mar 2013 14:37:40 +0100 (CET)
> > Daniël Mantione <daniel.mantione at 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.
>
> interface
>
> function substring(x,y:unicodestring):cardinal;
> function substring(x,y:ansistring):cardinal;
> function substring(x,y:shortstring):cardinal;
>
> implementation
>
> {...}
>
> var a:unicodestring;
> b,c:ansistring;;
>
> begin
> a:='banana-split';
> b:='banana-split';
> c:='banana';
> writeln(substring('banana','banana-split'));
> writeln(substring(b,a));
> writeln(substring(a,a));
> end.
>
>
> ... we would have 3 cache lookups, and 3 misses. Then we have end of
> scope, the symtablestack changes, and we therefore have to invalidate the
> cache. In this example, a cache would therefore slowdown instead of
> speed-up.
Yes, that's one of the reasons why I disabled the cache in codetools for
procedure overloads.
But I was talking about operator overloads. AFAIK there far less
operator overloads. And if a unit uses operator
overloads, then usually only a few, but many times.
I guess many units do not use overloaded operators at all.
Is it possible to measure how much time the compiler spends on
searching overloaded operators?
Mattias
More information about the fpc-devel
mailing list