Mike invited other programmers to do some direct comparison to the
Microsoft VC6 C compiler to see if the claims made about the PowerBASIC
compiler stood up to the test. I have bothered to make a pair of
algorithms in both Microsoft C and PowerBASIC and clock them against each
other.
I have bothered to do this for a reason, its not a matter of polemic
against Mike but to help assure PowerBASIC programmers that the compiler
they area using can mix it in performance terms with the leading edge C
compiler from Microsoft.
Now I confess that my C is in a bad state of disrepair and its only going
to get worse but I remember enough to write a comparison that involves
direct loop optimisation comparison between the two compilers.
With the C program that carried the test, I used the following compiler line,
h:\msc6\bin\cl /c /G6 /GA /TC /FA /Fa project2.c >> build.txt
I tried three compiler optimisations but two of them prevented the algorithm
from running and the third did not change the time. ;/O2 /Ot /Og
With the PowerBASIC program that carried the test piece, it ran the default
compiler optimisation.
On my PIII 600, I got the following results,
MS C version 6 ==> 13.172 seconds
PowerBASIC v 6 ==> 12.016 seconds
These times may vary on different hardware but I think they speak for
themselves, in terms of compiler produced loop optimisation, Bob Zale got
it right the first time.
The difference in complexity of the code is also obvious, the basic code
is both easier and faster to write and get going.
I think PowerBASIC programmers can safely work on the assumption that
their code will run fast enough when they just get it going, it will
probably run faster if they bother to do some more work on it and if all
else fails and performance is still a problem, you can write some pure
PowerBASIC inline assembler.
Regards,
[email protected]
[This message has been edited by Steve Hutchesson (edited September 26, 2000).]
Microsoft VC6 C compiler to see if the claims made about the PowerBASIC
compiler stood up to the test. I have bothered to make a pair of
algorithms in both Microsoft C and PowerBASIC and clock them against each
other.
I have bothered to do this for a reason, its not a matter of polemic
against Mike but to help assure PowerBASIC programmers that the compiler
they area using can mix it in performance terms with the leading edge C
compiler from Microsoft.
Now I confess that my C is in a bad state of disrepair and its only going
to get worse but I remember enough to write a comparison that involves
direct loop optimisation comparison between the two compilers.
Code:
MICROSOFT C version 6 // ####################################################################### void TestProc() { DWORD counter1; counter1 = 0; while (counter1 < 1000000) { DWORD counter2; DWORD var1; DWORD var2; DWORD var3; DWORD var4; counter2 = 0; while (counter2 < 1000) { var1 = 1; var2 = 2; var3 = 3; var4 = 4; counter2++; } counter1++; } } // ####################################################################### PowerBASIC version 6 ' ######################################################################### SUB TestProc() LOCAL var1 as DWORD LOCAL var2 as DWORD LOCAL item1 as DWORD LOCAL item2 as DWORD LOCAL item3 as DWORD LOCAL item4 as DWORD var1 = 0 while var1 < 1000000 var2 = 0 while var2 < 1000 item1 = 1 item2 = 2 item3 = 3 item4 = 4 var2 = var2 + 1 wend var1 = var1 + 1 wend END SUB ' #########################################################################
h:\msc6\bin\cl /c /G6 /GA /TC /FA /Fa project2.c >> build.txt
I tried three compiler optimisations but two of them prevented the algorithm
from running and the third did not change the time. ;/O2 /Ot /Og
With the PowerBASIC program that carried the test piece, it ran the default
compiler optimisation.
On my PIII 600, I got the following results,
MS C version 6 ==> 13.172 seconds
PowerBASIC v 6 ==> 12.016 seconds
These times may vary on different hardware but I think they speak for
themselves, in terms of compiler produced loop optimisation, Bob Zale got
it right the first time.
The difference in complexity of the code is also obvious, the basic code
is both easier and faster to write and get going.
I think PowerBASIC programmers can safely work on the assumption that
their code will run fast enough when they just get it going, it will
probably run faster if they bother to do some more work on it and if all
else fails and performance is still a problem, you can write some pure
PowerBASIC inline assembler.
Regards,
[email protected]
[This message has been edited by Steve Hutchesson (edited September 26, 2000).]
Comment