GNU GCC Vs Sun's Compiler on a SPARC
JigSaw writes "When doing research for his evaluation of Solaris 9 on his Ultra 5, Tony Bourke kept running into the same comment online over and over again: Sun's C compiler produces much faster code than GCC does. However, he couldn't find one set of benchmarks to back this up and so he did his own."
I wish this guy would tell us what CPU he's using. There's a hell of a lot of difference between the low-cache and high-cache CPUs (yes, these will work in a u5 as well as a u10). Looks like he's using a low-cache one, where there's not as much difference (and where the 64bit penalty isn't as noticeable).
To me this was the most interesting line of the article:
Sun's compiler was the clear winner. Surprisingly, the older version of GNU's GCC beat 3.3.2 by a very slim margin.
One of my favorite version numbers (2.95.3) is still getting good press. Cool.
dtg
The truth is an offense, but not a sin.------R. N. Marley
Read the articles. 2MB cache, 333 MHz UltraSPARC IIi
Be nice if we could read the gifs.
I used Sun's new compiler to compile new drivers for my old 14.4 faxmod=20 ]} } } }&..}=3Dr}'}"}[NO CARRIER]
Of course a vendors supplied compiler that doesn't have to even think about potential optimizations for another platform will outperform it. It is a testiment to the gcc folks that it is even close.
I have mod points and I am not afraid to use them
See Tony Bourke's older article, which conluded that 64 bit binaries are slower than 32 bit binaries. This set of statistics he posted has totally obliterated his previous conclusion. He had only used GCC 3.3.2 and assumed that compiling for both 32 and 64 bits were optimized similarly. However, in most of the benchmarks he did with Sun's compiler, 64 bit programs came ahead of 32 bit ones. This means that GCC 3.3.2 is not as well optimized for his computer for 64 bits as for 32 bits, while the Sun compiler is. If he had just looked at his own data, he would have seen that.
...and a better performance not even all of the time, especially on a 32-bit platform, I choose GCC.
However, I'd like to see a well-thought out criticism of this piece. It seems like someone always has a good counterpoint to any given set of benchmarks.
Using DEPRECATED compilers is just as stupid as using DEPRECATED kernels(2.4, just to name one)
How is 2.4 deprecated? 2.6 is not even in all distros yet. Even Linus says wait on 2.6.1 or 2.6.2 to get any real work done.
So, the benchmarks show maybe a 10-15% difference in favor of Sun's compiler. Does that Sun's compiler a "clear winner"? I think not.
First of all, it's far from clear that those differences are real. You can get much bigger differences from just changes in caching behavior, even with the same compiler.
Then, there is the question of whether Sun's compiler is actually correct. A lot of commercial compilers intentionally skirt or break the letter of the ANSI standards once you start enabling optimizations. GNU C/C++ is usually more careful.
Finally, you have to ask whether it matters. So, Sun's overpriced machines using their overpriced compilers run a bit faster than their overpriced machines using a free compiler. So what? If you want bang for the buck, or even just maximum bang, why in the world would you buy a Sun these days anyway?
Next they'll be concluding what language is fastest by writing "Hello World!" in C (compiled in 64 & 32 bit), Logo, Perl and Prolog.
I hope to be posting a full writeup on how much faster MS-DOS is compared to BSD using boot times as a benchmark.
Conformity is the jailer of freedom and enemy of growth. -JFK
It's important to remember that Sun's compilers are optimized for Sun's big machines, so you don't really see the biggest advantages of the Sun compilers on single or even dual CPU machines. The Sun compilers really shine on the massively SMP machines such as the 10K, 12K, and 15K.
Of course I don't have any links to benchmarks that prove this, so take it or leave it. But Sun specifically does not care about compiler optimization for their "toy" machines such as the Ultra 5, Ultra 10, Blade 100, etc. Basically, if your Sparc CPU isn't a straight II or straight III, Sun's not as concerned with you.
I did not design this game/I did not name the stakes/I just happen to like apples/And I am not afraid of snakes-AniD
It is available in all non-DEPRECATED distros.
Using DEPRECATED compilers is just as stupid as using DEPRECATED kernels(2.4, just to name one)
Reason number 27 that I switched from Linux to FreeBSD. I got sick and tired of being treated like a lame poser just because I was still using last week's kernel.
Don't blame me, I didn't vote for either of them!
Well slice it which ever way you want, this jives with what i hear about the virtual water cooler. gcc is all well and good on x86 (as where its been tweaked for ages) but not always the best elsewhere. MacOS X is where i hear this mostly. The more aggressively it get used outside of x86 land the more it will get tweaked.
Move along nothing to see here.
Reason 2 why I switched from FreeBSD to Linux: Linux creams FreeBSD in performance. Reason 1: FreeBSD zealots.
Reason number 26 must have been that you bite on messages clearly marked [TROLL] -- seems to be a pretty common trait among *BSDers.
The author uses -fast for all compilation with the Sun compiler, but that really isn't what it's meant for. The manual page for the compiler states that -fast is only good for a small portion of code in a program which requires the most optimization. In most cases, it results in optimizations that increase code size, and in my experience, change results of some operations. For instance, attempting to compile OpenPGP extensions to Perl (Crypt::OpenPGP, Crypt::RSA, Crypt::DSA, etc.) resulted in some strange departures from the expected test suite results. Compiling with a more reasonable optimization level (and no other changes) resulted in correct test suite results.
Basically, the compiler docs suggest that -fast is intended to be used with the -# flag, which expands the -fast macro into all of it's component switches. It is then up to the user to pick and choose the optimizations that are kept on for the entire code base, and which are only kept for sections of code which beneifit from extreme optimization.
Long and short: it would be interesting to see these results with a reasonable set of switches. I use Solaris 9 on a dual 450MHz Ultra 60 workstation, compiling with Forte C 5.5. For most tasks, I use the optimization flags '-xO3 -xarch=v8plusa -xspace'.
My $0.02
I worked for a compiler vendor once and at a particular point in time Greenhill Oasis, a competitor, compared Drystones benchmarks values in an advertisment between ourselvs, gcc and their own compiler. They turned out to be 3 to 5 times faster than us and almost twice as fast as gcc at the time (10 years ago). Obviously thay had put in specific Drystones optimzations in the compiler so we did the same and counter striked their figures in 6 months at 35% faster code if I remember it correctly. During the meantime we lost quite some business, still we did better than them on regular code, debugability and jada jada, all along.
It is a leapfrog game, choose the tools you like and don't make assumptions solely on benchmark figures. I am 100% gcc today and would only use anything else if a particular cross target wouldn't be mature enough or on the limit for the system performance.
would it have improved the scores for gcc any if he had used the march flag instead of the mcpu flag? It seems to me that it might have made at least a little bit of difference.
And the muscular cyborg German dudes dance with sexy French Canadians
...of who is using SPARC instead of x86 if they're worried about a 5% performance difference.
May we never see th
open4free
Which compiler is fastest at the act of actual compilation?
If GCC compiles mysql in 10 minutes and Sun's compiler takes 15...
Which compiler makes smaller binaries?
http://gcc.gnu.org/projects/tree-ssa/a pshot/ a pshot/gcc-ssa-3.5ssa-0.20040129.snapshot.src.rpm (24.4M)p ers/ p ers/gccsummit-2003-proceedings.pdf (1'383'108 bytes)r oceedings.pdf (1'383'108 bytes)p ers/nordu2003-slides.pdf (102'895 bytes)p ers/nordu2003.pdf (153'101 bytes)p ers/tree-ssa-gccs03-slides.pdf (90'925 bytes)p ers/tree-ssa-gccs03.pdf (87'507 bytes)
http://people.redhat.com/dnovillo/pub/tree-ssa/sn
http://people.redhat.com/dnovillo/pub/tree-ssa/sn
http://people.redhat.com/dnovillo/pub/tree-ssa/pa
http://people.redhat.com/dnovillo/pub/tree-ssa/pa
== http://www.linux.org.uk/~ajh/gcc/gccsummit-2003-p
http://people.redhat.com/dnovillo/pub/tree-ssa/pa
http://people.redhat.com/dnovillo/pub/tree-ssa/pa
http://people.redhat.com/dnovillo/pub/tree-ssa/pa
http://people.redhat.com/dnovillo/pub/tree-ssa/pa
ftp://ftp.kernel.org/pub/linux/devel/binutils/binu tils-2.14.90.0.8.tar.bz2 (11'015'696 bytes)
open4free
I recall that the SPARC processor has an equivalent instruction set to MMX. I also recall that the Sun C compiler supports this and that GCC does not. For those of us involved in signal processing and image processing this would be a big win.
Also this would seemingly be a very big win for the Sun C compiler.
Any thoughts on this?
Also, it would be really nice to see some benckmarks with more floating point intensive operations.
- Andrew