g++ or SunPro CC? Is one considered to produce *better* code?

g++ or SunPro CC? Is one considered to produce *better* code?

Post by Larry Williams » Wed, 07 Dec 1994 22:56:29



I know this could be quite a difficult thing to measure. I also am
afraid it may be a bit of a religious issue for some.

We have been using g++ for a long time and are quite happy with it.

We have an application that some say "would run faster if we used the
vendor's compiler, because of course the vendor knows best how to
optimize for their own architecture."

I say piffle! But I am willing to be convinced.

Any comments?

Larry

 
 
 

g++ or SunPro CC? Is one considered to produce *better* code?

Post by J. Heather Patri » Sat, 10 Dec 1994 12:01:21




>We have an application that some say "would run faster if we used the
>vendor's compiler, because of course the vendor knows best how to
>optimize for their own architecture."

>I say piffle! But I am willing to be convinced.

1) It is a fact that SunPro's compilers optimize better for sun4m type
   machines than g++/gcc. But I dont remember how much better.

2) It is also a fact that SunPro C++ generates much, much smaller
  executables, due to the fact that it doesn't rope in a bloated
  libg++.a, among other things. And sometimes, smaller means faster.

 
 
 

g++ or SunPro CC? Is one considered to produce *better* code?

Post by Casper H.S. D » Sat, 10 Dec 1994 18:24:09



>I know this could be quite a difficult thing to measure. I also am
>afraid it may be a bit of a religious issue for some.
>We have been using g++ for a long time and are quite happy with it.
>We have an application that some say "would run faster if we used the
>vendor's compiler, because of course the vendor knows best how to
>optimize for their own architecture."

In think the consensus is that:

        - Current SunPRO C compilers generate better (too much better) code
          with one exception: it doesn't fold float constants (perhaps this
          is fixed in the latest patches)
        - g++ is not a very good C++ compiler

Casper

 
 
 

g++ or SunPro CC? Is one considered to produce *better* code?

Post by Jason Patters » Mon, 19 Dec 1994 19:09:18


Quote:> >We have an application that some say "would run faster if we used the
> >vendor's compiler, because of course the vendor knows best how to
> >optimize for their own architecture."

This isn't necessarily so. "Serious" commercial compilers from
specialist compiler companies frequently outperform the vendor's
compilers. On SPARC the best example of this is the Apogee
compilers - even Sun use them for benchmarking (see the notes
at the bottom of the SPEC tables and newsletters).

Quote:>    - Current SunPRO C compilers generate better (too much better) code
>      with one exception: it doesn't fold float constants (perhaps this
>      is fixed in the latest patches)

I agree, mostly, although GCC easily beats SunPro C on some code
(eg: gcc from SPECint92). As with everything, there are swings and
roundabouts... So I'd probably water down the "too much better" bit.

On SPECint92 on an SS10/40, with absolutely the best set of flags
chosen for each compiler (I can supply these to anyone who is
interested), I get:

                   SPECint92
                   =========
      GCC 2.6.0:     46.2
 SunPro C 3.0.1:     50.7
   Apogee C 3.0:     55.3

(interesting sub-note: when Sun originally benchmarked the SS10/40
with the V2.0 Apogee compilers they got 51.x, so its interesting to
note the speedup due to compiler improvements since then)

So I'd say the difference between GCC and SunPro C is about 10%.
G++ vs SunPro C++ is probably similar, since both C++ compilers
share their back-ends with their C partner. Note that Apogee is
about 10% better than SunPro...

Quote:>    - g++ is not a very good C++ compiler

I wouldn't say that. For a _LONG_ time G++ was _WAY_ better than
SunPro's C++ offering (cfront). SunPro's C++ 4.0 has changed that,
and now I'd rate it as better than G++ because of the better
de*, but I certainly wouldn't say that "g++ is not a very
good C++ compiler".

If the original poster is really serious about absolute maximum
performance, Apogee's new C++ compiler is probably the way to go...


  Imagine that CRAY decides to make a personal computer. It contains 16
  `Alpha' based processors executing in parallel, has 500 megabytes of RAM,
  2500 Megabytes of disk storage, a resolution of 4096 x 4096 pixels, does
  24bit 3D graphics in realtime, relies entirely on voice recognition for
  input, fits in your shirt pocket and costs $300. What is the first
  question the computer community asks?

  "Is it DOS compatible?"

 
 
 

1. Can't link exception code (Using SunPro CC 4.0.1)

The FAQ maintainer cheated and added this to the FAQ:

+5.42) When linking C++ programs, I get "_ex_keylock" undefined.

    You installed a patch for your C++ compiler but forgot to install
    the companion patch for libC.so.5.

    Fix: install patch 101242-10 or later.

    --- end of excerpt from the FAQ

Questions marked with a * or + have been changed or added since
the FAQ was last posted

The most recently posted version of the FAQ is available from
ftp.fwi.uva.nl in directory /pub/solaris
--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.

2. Help! Can't connect to X Server:0:0

3. cc -O producing faulty code

4. running scripts from .forward file

5. Dterror Logout

6. one line of comment per line of code considered harmful?

7. Fw: PROBLEM: Conntrack/NAT bug

8. Can SunPro cc and gdb work together?

9. Walking up the stack, unmangling C++ function names (SunPRO CC 4.0)

10. Sunpro cc vs gcc

11. sunperf & Sunpro CC

12. SunPro compilers -- cc and acc, what's the difference?