[fpc-devel] Patch for rtl/inc/rtti.inc

Daniël Mantione daniel.mantione at freepascal.org
Sun Sep 14 16:42:52 CEST 2008



Op Sun, 14 Sep 2008, schreef Florian Klaempfl:

> Daniël Mantione schrieb:
>> 
>> 
>> Op Sun, 14 Sep 2008, schreef Jonas Maebe:
>> 
>>> 
>>> On 14 Sep 2008, at 14:49, Markus Beth wrote:
>>> 
>>>> this patch rewrites code of ArrayRTTI and fpc_Copy to allow the compiler 
>>>> to generate faster code (at least on i386).
>>>> The change in ArrayRTTI yields a performance gain of ~4% for our real 
>>>> world application on a 3 GHz Intel Xeon.
>>>> The change in fpc_Copy is completely untestet because I don't know when 
>>>> this compilerproc is called. Maybe someone who knows can hack a quick 
>>>> benchmark...
>>> 
>>> I don't think it's a good idea to start manually adding loop induction 
>>> variables to many routines in the rtl. It makes the code less 
>>> maintainable, and at one point the compilation process itself will/should 
>>> do that by itself.
>> 
>> This patch should get applied. It's debatable wether additions are hard to 
>> maintain than multiplications and it may take years before the compiler can 
>> do that optimization. That doesn't mean we should optimize anything 
>> manually, but fpc_copy is definately speed critical code for things like 
>> widestrings.
>
> Shall I implement automatic simple loop induction variable tonight :)?

No, do it in a proper and maintainable way :) Seriously, we should not 
obstruct user contributions by raising questionable maintainability 
issues.

To the point: Any manual optimization can be done automatically, however, 
after 15 years of FPC we still are optimizing manually. That's the 
compiler writers full employment theorem.

Once the compiler can do these optimizations, then we can start to reject 
patches.

Daniël


More information about the fpc-devel mailing list