Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2010-10

faster FillChar for IA32/IA64?

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dimitri Smits

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

Reply by email

Florian Klaempfl
to Dimitri Smits
Dimitri Smits wrote 10 lines
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?

I asked him, got his permission and adapted the code to FPC.

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?

Because it is much easier to act up oneself on the mailing list than doing actual work.

Reply by email