Fastcode ComplexPolAdd B&V 2.0.0



Hi

I used the PolAdd B&V as template for PolMul and because of this I found a
some problems in it. This version fixes these issues:

In all subbenchmarks a line of code was misplaced

function TMainForm.SubBenchmarkExtended1 : Cardinal;
var
I1, I2, I4, I5 : Cardinal;
Succes : Boolean;
lpFrequency, lpPerformanceCount, StartCount, EndCount, NoOfTicks,
MinNoOfTicks : Int64;
RunTimeSec : Double;
NoOfTicksArray : array of Int64;

begin
Edit1.Text := IntToHex(Integer(@ExtendedSrc1Sub1BenchmarkArray[0]), 8);
Edit2.Text := IntToHex(Integer(@ExtendedSrc2Sub1BenchmarkArray[0]), 8);
Edit3.Text := IntToHex(Integer(@ExtendedResultSub1BenchmarkArray[0]), 8);
Update;
Succes := QueryPerformanceFrequency(lpFrequency);
if not Succes then
raise Exception.Create('QueryPerformanceFrequency failed');
//Succes := QueryPerformanceCounter(lpPerformanceCount);//Incorrect
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
SetLength(NoOfTicksArray, NOOFRERUNS);
for I1 := 0 to NOOFRERUNS-1 do
begin
Succes := QueryPerformanceCounter(lpPerformanceCount);//Correct
if Succes then
StartCount := lpPerformanceCount
else
raise Exception.Create('QueryPerformanceCounter failed');

This error can influence the benchmark precision.

I jumped the version number to 2.0.0 to signal a change in the benchmark
code.

In all subbench2 subbenches the final line was

Result := Round(RunTimeSec*SUBBENCH1SCALE);
end;

It should be

Result := Round(RunTimeSec*SUBBENCH2SCALE);
end;

This makes no difference because

SUBBENCH1SCALE : Double = 300;
SUBBENCH2SCALE : Double = 300;

Then all the benchmark arrays alignment code could be rewritten because
D2006 uses FastMM4 which 16 byte aligns all allocations >= 148 bytes.
One much however remember that dynamic arrays have an 8 byte preamble that
destroys the 16 byte alignment

16 byte Aligning Dynamic Arrays
http://qc.borland.com/wc/qcmain.aspx?d=14769

All 6 subbenches contained this code which could be called only once in
MainForm.OnCreate.

Succes := QueryPerformanceFrequency(lpFrequency);
if not Succes then
raise Exception.Create('QueryPerformanceFrequency failed');
SetLength(NoOfTicksArray, NOOFRERUNS);

This change removes code from the subbenchmarks that calls the WindowsAPI
and the MM and will potentially improve precision.

In the benchmark test a spread < 2% was marked as good

if MaxSpread > 2 then
MaxSpreadBenchPercentageEdit.Color := clYellow;
if MaxSpread > 5 then
MaxSpreadBenchPercentageEdit.Color := clRed;

we have tigthened this generally to

if MaxSpread > 1 then
MaxSpreadBenchPercentageEdit.Color := clYellow;
if MaxSpread > 2 then
MaxSpreadBenchPercentageEdit.Color := clRed;

and I changed that too.

All other Complex number B&V's should be checked for these issues too. I
will do that in the near future.

Best regards
Dennis Kjaer Christensen


.