Re: filling big array of double
- From: Henri Gourvest <x@xxxxx>
- Date: Tue, 31 May 2005 16:53:41 +0200
Eric Grange wrote:
> It is 2 times slower
Hmmm... than what? ;)
:)
Got me curious, and I tested the pascal code you posted in your reply to Aleksandr (after adapting it to double, the code you posted was for Integers), on AthlonXP it came out 1.5x faster than your pascal version for large arrays (and approx 2x for small arrays).
Eric
I'm testing on a P4 3Ghz and this is my code:
procedure FillDouble(var Dest; Count: integer; Value: double); register;
{$IFNDEF USEASM} // 2687 ms
var
i: integer;
p: PDouble;
begin
p := @dest;
for i := 1 to count do
begin
p^ := Value;
inc(integer(p), 8);
end;
end;
{$ELSE} // 5656 ms
asm
test edx, edx
jz @@End
fld qword ptr [ebp+8]
@@Loop:
fst qword ptr [eax]
lea eax, eax+8
dec edx
jnz @@Loop
ffree st(0)
@@End:
end;
{$ENDIF}procedure TForm1.Button2Click(Sender: TObject);
var
c: cardinal;
i: integer;
buffer: array[1..1000] of double;
begin
c := GetTickCount;
for i := 1 to 1000000 do
FillDouble(buffer, length(buffer), 1.1);
memo1.Lines.Add(inttostr(GetTickCount - c));
end;.
- Follow-Ups:
- Re: filling big array of double
- From: Eric Grange
- Re: filling big array of double
- From: Aleksandr Sharahov
- Re: filling big array of double
- References:
- filling big array of double
- From: Henri Gourvest
- Re: filling big array of double
- From: Eric Grange
- Re: filling big array of double
- From: Henri Gourvest
- Re: filling big array of double
- From: Eric Grange
- filling big array of double
- Prev by Date: Re: filling big array of double
- Next by Date: Re: Fastcode MM B&V 0.40
- Previous by thread: Re: filling big array of double
- Next by thread: Re: filling big array of double
- Index(es):