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
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to