Mail Archives: djgpp/1997/08/28/18:51:50
On Thu, 28 Aug 1997, Michael L. Smith wrote:
..
> C Version:
>
> int i;
> int x;
>
> main()
> {
> for(i=1; i<1000000000; i++) x=i;
> }
>
> Basic Version: (identical version used for both OmniBasic and Power
> Basic)
>
> dim i as long
> dim x as long
>
> for i=1 to 1000000000
> x=i
> next i
That's meaningless as a benchmark, it's just a do-nothing loop. Since
OmniBasic outputs C code that GCC compiles, it can't be faster than GCC,
even if it's a compiler in its own right. Try this for the C version, and
see if OmniBasic is still faster:
register int i;
int x;
main()
{
for (i = 1; i < 1000000000; i++) x = i;
}
and compile it with gcc -O3 -fomit-frame-pointer
I'm pretty sure that OmniBasic gets its marginally faster times on this
"benchmark" with the judicious use of register variables and compiler
optimizations.
Besides, using the above "benchmark" is pretty worthless. I think a better
test of each compiler would be to calculate the Fast Fourier Transform of
a very large 2D array. Functions to do this are available in both Basic
and C, and at least it's a "real world" application.
-------------------------------------------------------------------
Orlando Alcantara Andico
WWW: http://www2.mozcom.com/~orly/ Email: orly AT mozcom DOT com
ICBM: 14 30 00 N 120 59 00 E POTS: (+632) 932-2385
- Raw text -