[fpc-devel] Forwarded message about FPC statusy

Yury Sidorov jura at cp-lab.com
Tue Dec 25 14:59:08 CET 2012


From: "Yury Sidorov" <jura at cp-lab.com>
> From: "Florian Klaempfl" <florian at freepascal.org>
>
>> Am 25.12.2012 13:39, schrieb Yury Sidorov:
>>> It is possible to seed-up compilation by allocating memory for 
>>> nodes
>>> from some zero pre-filled memory pool to avoid costly calls to 
>>> heap
>>> manager and avoid zero filling of small memory chunks. A base 
>>> class for
>>> various FPC nodes should be modified to handle aloocation from the 
>>> pool...
>>
>> The heap manager itself does already pooling so I don't see much 
>> gain in doing so ...
>
> Still zero-filling a million of small memory chunks is very time 
> consuming. It is better to pre-zerofill big pool blocks first and 
> then assueme that memory already zero fillled in custom object init 
> code.
>
> Although FPC heap manager is good, but custom pool memory allocation 
> will be much faster, since it will be very simple:
>
>  Result:=CurPoolPtr;
>  Inc(CurPoolPtr, BlockSize);
>  if CurPoolPtr > MaxPoolPtr then AllocNewZeroFilledPool();
>
> It is not needed to handle memory releases during object 
> destruction. Since all nodes are available during whole compiling 
> phase (parsing, code generation, etc) and released only at the end 
> of a phase, it is possible just to release whole pool blocks at the 
> end of a phase.
>
> Such pooled base class for compiler nodes should inrease performanse 
> a lot.

Hmm, Seems to be a false alarm :(

I've made some tests just now with memory allocation and found that 
such pooling will not speed up the compiler too much. Only minor 
improvement such as 10-20% :(

Yury Sidorov, jura at cp-lab.com



More information about the fpc-devel mailing list