From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,e2617bb212aeb68e X-Google-Attributes: gidfee84,public From: Jeff Sullivan Subject: Re: DecC vs. gcc-2.8.1, why is the difference in speed so large? Date: 1999/06/08 Message-ID: <375D5250.9EF97EF7@zk3.dec.com>#1/1 X-Deja-AN: 487148074 Content-Transfer-Encoding: 7bit References: <7jjcs4$kvg@ds2.acs.ucalgary.ca> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Compaq Computer Corporation Mime-Version: 1.0 Newsgroups: comp.unix.osf.osf1 Serguei Patchkovskii wrote: > Your benchmark is meaningless, as the entire inner loop computing 'x' > can be eliminated after simple local analysis of the do_that() subroutine. > gcc deliberately refrains from performing loop elimination in such cases, > as this can result in unexpected results for programs relying on loops for > delays (which is a bad idea in any case - but that had never stopped anyone). > DEC cc apparently removes your inner loop at the default optimization level, > which can easily explain a factor of 50 difference in the timing. Yes, this is true. The original test case that was posted also contained this in main(): do_that; /* instead of do_that(&some_int); which is not actually a function call and even more meaningless. There are many test cases and "real world" code that will demostrate the improved optimizations provided by Compaq C (formerly DEC C), but this case is not a very good (or fair) example. For developers interested in an even more advanced compiler for UNIX V4.0D and later, you might take a look at the Developer's Toolkit for Tru64 UNIX. See http://www.unix.digital.com/developerstoolkit/ -Jeff -- Jeff Sullivan | Compaq Computer Corp | mailto:jps@zk3.dec.com Compaq C/C++ | Nashua, NH ZK3-2X23 | Jeff.Sullivan@compaq.com