From: "Florian Klaempfl" <flor...@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.

Yury Sidorov, j...@cp-lab.com _______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to