[fpc-devel] faster FillChar for IA32/IA64?

Dimitri Smits smitco at telenet.be
Wed Oct 27 01:49:35 CEST 2010


Hi, 

I was wondering why on several occasions in discussions regarding compiler design and parser branches it was mentioned (especially by Florian) that FPC is in need of a faster FillChar. 

The reason for this bewonderment is that I see code regarding the fastmove that is by John O'Harrow of fastcode fame in the i386 dir. Was this donated by him, or was it an adaptation of the fastcode code with another licence slapped onto it? 

If so, why not contact him for his fillchar routine (or do the same as with the fastmove) that was entered in the fastcode contest for a fillchar method? 

http://fastcode.sourceforge.net/ 

ps: 
the current fillchar implementation has 2 caveats and one "heavy" instruction 
* misaligned buffers are not handled, resulting in misaligned 32bit memory-writes and possibly penalty's. Donno if this can happen, but still. (shortstring initialisation?) 
* the check for count <= 0 can be done sooner 
* the imul is not as expensive as before, but still is "heavy". Especially when the fillchar is 0, this is heavy and can better be replaced by a xor %eax,%eax or maybe even better if the value is always extended to 32bit/64bit in this special case. 

As I understand its mostly used use case is for zero'ing memory when used in compiler/runtime memory initialization/finalization, it might bring a small upgrade in speed (more so if it is for lots of small memory-block zero'ing). 

kind regards, 
Dimitri Smits 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20101027/4e3039a9/attachment.html>


More information about the fpc-devel mailing list