delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/29/05:18:37

From: ksharrel AT mindspring DOT com (Kelly Shane Harrelson)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: OmniBasic benchmark
Date: Fri, 29 Aug 1997 03:59:25 GMT
Organization: MindSpring Enterprises
Lines: 61
Message-ID: <34064890.8186726@news.mindspring.com>
References: <Pine DOT SGI DOT 3 DOT 93 DOT 970829064137 DOT 27965A-100000 AT gibson>
Reply-To: ksharrel AT mindspring DOT com
NNTP-Posting-Host: user-37kbn9h.dialup.mindspring.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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

- Raw text -


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