[fpc-devel] Thoughts: Make FillChar etc. an intrinsic for specialised performance potential

Benito van der Zander benito at benibela.de
Sat Apr 16 18:06:22 CEST 2022


Hi,

> FillChar is on most platforms an assembly function and FPC *never* 
> inlines assembly functions. 

even without inlining, rep stosb is faster than FillChar:

  {$asmmode intel}
procedure repfillchar(var buffer; len: sizeuint; c: byte);
begin
   asm
     mov al, c
     mov rdi, buffer
     mov rcx, len
     rep stosb
   end;
end;


1GB:
fillchar: 364 ms
repfillchar 321 ms

4GB:
fillchar: 1382 ms
repfillchar:1217 ms

Bye,
Benito
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20220416/9eab92dc/attachment.htm>


More information about the fpc-devel mailing list