[fpc-devel] Improved compiler speed by 20%

Sergei Gorelkin sergei_gorelkin at mail.ru
Mon Nov 19 16:49:57 CET 2007


Hello,

I have spent some time to profile the compiler using callgrind, and was
able to improve its speed by about 20%. Attached are the changes that I
made to the sources.

Some comments:
daopt386.pas: original code was calling fpc_varset_load (twice),
fpc_varset_create_element and fpc_varset_add - all for just setting a
single bit! I wonder if that can be done slower at all :)

ppu.pas: probably the commented out block must be appropriately
$ifdef'ed. But at least on i586 System.Move is optimized so well that
always calling it makes tppufile.readdata about twice faster.

fppu.pas: The design of compiler messaging (load and format messages 
_before_ checking verbosity level) is good for errors and
warnings, but is a waste of time for reporting several thousands tried 
and used units. Therefore I added verbosity checks before any attempts 
to output something.

cfileutils.pas: Rewrote FixPath() and FindFile() to exclude implicit 
AnsiString temp vars and so on.

cmsgs.pas: used ShortString version of StrPas() to avoid conversions.

I hope that at least some of this patching can be used in mainstream :)

Best regards,
Sergei
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compiler-patch.zip
Type: application/x-zip-compressed
Size: 2509 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20071119/b231abcf/attachment.bin>


More information about the fpc-devel mailing list