[fpc-devel] Re: Comparison FPC 2.6.2 - Kylix 3

Daniël Mantione daniel.mantione at freepascal.org
Mon Mar 4 15:00:30 CET 2013



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.

Daniël


More information about the fpc-devel mailing list