Re: I need the fastest routine



Hi Stig

Well, Q, am I the only one who is getting somewhat curious about this
thread ?

Well.. I thought they might :-)


Clément wrote:
By replacing the routines, from the old, to mine... etc

So assuming that 'mine' is the original code, what was the original -
original code ?


The original code I <VBG>optimized</VBG>:

procedure MinMaxArrayOrig( aArray : Array of Double; out aMinArray, aMaxArray : Array of double );
var
i : integer;
begin
aMinArray[1]:=aArray[0];
aMaxArray[1]:=aArray[0];
i:=1;
while (i<=high(aArray)) do begin
aMaxArray[ ord( aArray[i] > aMaxArray[1] ) ] := aArray[i];
aMinArray[ ord( aArray[i] < aMinArray[1] ) ] := aArray[i];
inc(i)
end;
end;


the results:
In order to obtain the posted results, I had to change the procedure declaration from

procedure MinMaxArrayOrig( aArray : Array of Double; out aMinArray, aMaxArray : Array of double );

to

procedure MinMaxArrayOrig( const aArray : Array of Double; out aMinArray, aMaxArray : Array of double );


// Prior to Original post
ArrayOrig 334260152 - 4.00000000000000E+0000 9.99999200000000E+0006

Array0 44658696 - 4 9999992
Array1 29846448 - 4 9999992
Array2 27265964 - 4 9999992
Array3 18771676 - 4 9999992
Array4 20511472 - 4 9999992
Array5 105058428 - 4 9999992 // Original post
Array6 64012668 - 4 9999992
Array7 28452764 - 4 9999992
Array8 22176132 - 4 9999992
Array9 32827220 - 4 9999992
Array10 32593756 - 4 9999992
Array11 31900212 - 4 9999992
Array12 32360978 - 4 9999992


The benchmark we used was not based on RDTSC instruction, but

T0 := Now;
SomeProc
T1 := now;


This thread IS very enlightening.

Clément




.