Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: c compilati...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 17 of 38 Topic 26135 of 26955
Post > Topic >>

Re: c compilation - gcc vs visual c

by William Ahern <william@[EMAIL PROTECTED] > May 10, 2008 at 04:23 PM

kumarchi@[EMAIL PROTECTED]
 wrote:
<snip>
> thanx all of you for responding. I was totally unprepared for such a
> vast performance difference (2x msvc vs gcc) and my code is not at all
> special(no UI, complicated cl***** etc).

Those are not the types of things which cause modern compilers to stumble.
They seem complex abstractly, but to a compiler are fairly transparent.

> it simply does lots of floating point array(mainly through fft) and
normal
> integer operations

These are things for which compilers are designed to be highly optimized,
and for which failure to enable a seemingly minor feature can cause huge
variance in performance, like you're seeing.

> I used -O3 flag and in my case so far it seems to be better than O2.
> msvc by default uses their own O2.
>
> I cannot believe such a blatant difference will go unnoticed for long

It's not gone unnoticed, it's merely gone largely uncommented in this
group
because this is the wrong group to ask. GCC is not that far behind MSVC.
All
the number and graphs I've seen suggest that something else is involved
here.

Yes, you should try GCC 4.x, because GCC 4.x implemented a different
optimization framework. But this probably doesn't account for the 2x
difference.

It's highly likely that the difference you're seeing is a failure to tell
GCC how and which CPU feature sets to target. GCC depends on the build
system to dictate all the various platform-dependent optimizations;
because
GCC is often used for cross-compiling, and for various other reasons, that
kind of logic--like CPU-specific optimizations (as opposed to mere
architecture)--is farmed out. It's likely that MSVC, or Visual Studio, is
turning knobs which in GCC must be done manually.

I recommend that you find another newsgroup, or web page, or other
do***entation, to help you turn GCC's knobs. The suggestions here, like
-msse, etc, are a _start_, but by no means exhaustive, or even sufficient.
There are lots of flags to know about; for instance, only the very latest
version of GCC 4.x (4.3, I think) automatically vectorizes, but only if
you
specify -msse and/or -mtune or something like that. Prior to 4.x, you need
to not only enable the instruction set, but enable vectorizing.

And there are probably tools/applications you can find which will help you
turn those knobs. I'm just not that familiar to give detailed advice. And
while many people are far more knowledgable in this group, you're apt to
get
conflicting or confusing advice because this issue isn't the group's
focus.
 




 38 Posts in Topic:
c compilation - gcc vs visual c
kumarchi@[EMAIL PROTECTED  2008-05-09 12:20:19 
Re: c compilation - gcc vs visual c
jacob navia <jacob@[EM  2008-05-09 22:20:09 
Re: c compilation - gcc vs visual c
Ulrich Eckhardt <dooms  2008-05-09 22:32:07 
Re: c compilation - gcc vs visual c
"Chris Thomasson&quo  2008-05-30 16:59:33 
Re: c compilation - gcc vs visual c
micans@[EMAIL PROTECTED]   2008-05-09 13:38:04 
Re: c compilation - gcc vs visual c
kumarchi@[EMAIL PROTECTED  2008-05-09 14:03:14 
Re: c compilation - gcc vs visual c
Ian Collins <ian-news@  2008-05-10 09:22:41 
Re: c compilation - gcc vs visual c
jacob navia <jacob@[EM  2008-05-09 23:50:30 
Re: c compilation - gcc vs visual c
Niz <notarealemailaddr  2008-05-09 23:08:26 
Re: c compilation - gcc vs visual c
"cr88192" <c  2008-05-10 15:28:50 
Re: c compilation - gcc vs visual c
"Sean G. McLaughlin&  2008-05-10 17:30:35 
Re: c compilation - gcc vs visual c
moi <root@[EMAIL PROTE  2008-05-09 23:21:36 
Re: c compilation - gcc vs visual c
Antoninus Twink <nospa  2008-05-10 00:13:19 
Re: c compilation - gcc vs visual c
"cr88192" <c  2008-05-10 08:41:39 
Re: c compilation - gcc vs visual c
kumarchi@[EMAIL PROTECTED  2008-05-09 17:59:22 
Re: c compilation - gcc vs visual c
Willem <willem@[EMAIL   2008-05-10 06:20:09 
Re: c compilation - gcc vs visual c
William Ahern <william  2008-05-10 16:23:36 
Re: c compilation - gcc vs visual c
kumarchi@[EMAIL PROTECTED  2008-05-09 18:16:26 
Re: c compilation - gcc vs visual c
Chris H <chris@[EMAIL   2008-05-10 13:32:58 
Re: c compilation - gcc vs visual c
roberson@[EMAIL PROTECTED  2008-05-10 12:49:26 
Re: c compilation - gcc vs visual c
jacob navia <jacob@[EM  2008-05-10 17:41:23 
Re: c compilation - gcc vs visual c
kumarchi@[EMAIL PROTECTED  2008-05-10 09:49:58 
Re: c compilation - gcc vs visual c
"Sean G. McLaughlin&  2008-05-10 17:29:06 
Re: c compilation - gcc vs visual c
moi <root@[EMAIL PROTE  2008-05-10 19:18:18 
Re: c compilation - gcc vs visual c
Chris H <chris@[EMAIL   2008-05-10 18:58:15 
Re: c compilation - gcc vs visual c
Chris H <chris@[EMAIL   2008-05-10 19:00:47 
Re: c compilation - gcc vs visual c
kumarchi@[EMAIL PROTECTED  2008-05-10 12:13:38 
Re: c compilation - gcc vs visual c
kumarchi@[EMAIL PROTECTED  2008-05-10 12:29:47 
Re: c compilation - gcc vs visual c
Rui Maciel <rui.maciel  2008-05-10 20:20:13 
Re: c compilation - gcc vs visual c
Barry Schwarz <schwarz  2008-05-16 19:12:48 
Re: c compilation - gcc vs visual c
Peter Nilsson <airia@[  2008-05-16 20:17:14 
[OT] Re: c compilation - gcc vs visual c
Tim Prince <tprince@[E  2008-05-16 23:30:55 
Re: c compilation - gcc vs visual c
Walter Banks <walter@[  2008-05-17 05:29:18 
Re: c compilation - gcc vs visual c
CBFalconer <cbfalconer  2008-05-17 06:59:53 
Re: c compilation - gcc vs visual c
Ben Bacarisse <ben.use  2008-05-18 14:00:22 
Re: c compilation - gcc vs visual c
kumarchi@[EMAIL PROTECTED  2008-05-30 09:09:43 
Re: c compilation - gcc vs visual c
Antoninus Twink <nospa  2008-05-30 19:34:08 
Re: c compilation - gcc vs visual c
"robertwessel2@[EMAI  2008-05-30 17:12:30 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 2:44:02 CDT 2008.