delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/31/17:19:38

From: mlsmith AT ktis DOT net (Michael L. Smith)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: OmniBasic benchmark
Date: Fri, 29 Aug 1997 16:01:12 GMT
Organization: Computer Design Lab
Lines: 77
Message-ID: <5u6ro8$tg_004@mlsmith.ktis.net>
References: <Pine DOT SGI DOT 3 DOT 93 DOT 970829064137 DOT 27965A-100000 AT gibson> <34064890 DOT 8186726 AT news DOT mindspring DOT com>
NNTP-Posting-Host: news.newsdawg.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <34064890 DOT 8186726 AT news DOT mindspring DOT com>, ksharrel AT mindspring DOT com wrote:
>Orlando Andico <orly AT gibson DOT eee DOT upd DOT edu DOT ph> wrote:
>
>>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
>>
>
>With the -O3 optimization turned on, it really is a "do nothing loop".
>GCC will detect that the result stored in x is never used and thus
>will never calculate it.  Since that is the only instruction in the
>loop, it willremove the loop.  The program should run instaneously.
>-Shane
>

Shane,

I was not aware what the -03 option did. It looks like Orlando is looking for 
every advantage he can get. In previous post he accused Omni of using register 
variables (which it was not) and then using them for himself. Now that I find 
out what the -03 does, it appears he really wants to stack the deck. What some 
people may be missing in all this is that we at Omni have a very high regard 
for both gcc and DJGPP or we wouldn't have invested over a 1000 man-hours into 
Omni which uses these great resources. The real point of the post was to show 
that one could obtain respectable speed (compared to C) using OmniBasic which 
is a higher level language and probably more suited for certain applications 
and at the same time not give up pointers, portability, etc.

-Mike

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019