[fpc-devel] Messages overhead

Hans-Peter Diettrich DrDiettrich1 at aol.com
Thu Jul 15 22:52:37 CEST 2010


Sergei Gorelkin schrieb:

> The issue was that, whenever compiler needs to output a message, it:
> - loads a messagefile (once in a session)
> - looks up the message by number
> - performs the parameter substitution (this involves AnsiStrings, so is 
> somewhat heavy)
> - only then checks if it should really print the resulting string.
> 
> The most amount of messages come from unit search; the system units are 
> loaded every time, so you always have about several thousands messages 
> loaded and discarded. This was taking a noticeable amount of executed 
> CPU instructions (profiled with Valgrind).

This is just what I concluded from a quick glance at the implementation.

> With the patch applied in r9297, I was able to cut the total number of 
> executed instructions down by 20%, but that gave no increase in 
> perceived speed of compilation. So I decided not to put much more effort 
> to this issue.

Good to know :-)

I think that it's time to put aside old experience, and replace it by 
up-to-date performance considerations. And since FPC seems to be 
optimized and tested very well, even if it doesn't look so at the first 
glance, I better concentrate on other tasks.

> Although, modifying the messaging system in a way when CheckVerbosity() 
> is called as soon as possible (before parameter substitution and other 
> processing) could be beneficial.

Then at least one can be sure that the mentioned overhead can not occur 
any more.

DoDi




More information about the fpc-devel mailing list