For the 32-bit runs, Sun's compiler actually got beat by one or even both GCCs for many of the operations. In general, the results were quite sporadic between the 3 compilers.


64-bit
As with the previous article, the 64-bit MySQL server binary was used, but the 32-bit Perl and MySQL client libraries were used to run the client end of the benchmarks in order to keep the client end of the tests consistent.


Sun's compilers produced a binary that beat GCC in all but the select operation.
Here's a view with all the compilers accounted for.


The results were all over the map for these runs. I went back to double check and make sure sql-bench wasn't producing sporadic results (which took quite a bit of time), but the runs were consistent.
The biggest surprise though was that Sun's 64-bit compiler created a binary that for most operations beat out all the others, whether they be 32-bit or 64-bit.
Conclusion
These were a limited set of tests on a limited number of applications run in limited ways, and I only tested the C compiler (and for MySQL, the C++ compiler). Still, we can draw a few interesting generalizations. First, Sun does indeed appear to produce faster code, although not always, and the difference in speed varied quite a bit, and toped out at about 22% faster.
The greatest differences were seen comparing 64-bit binaries between GCC and Sun's compiler, with Sun's compiler having a greater advantage. Another surprise was that GCC 2.95 tended to produce slightly faster code compared to 3.3.2, with a difference in the 2% range and not much more.
The difference in speed varied greatly throughout the tests and specific operations, so it all depends on the application as well as the particular function it performs.
As with the 32-bit versus 64-bit tests, it all depends on your application and what you're doing with it. If you've got an application that you really need optimized, trying with the three compilers listed here may be worth your time, especially since you can use Sun's compiler free in an evaluation mode.
Seeing that GCC performance isn't all that far off from Sun's compiler suite (and in a few operations, bests Sun), says quite a bit about the quality that GCC has been able to achieve, especially considering the magnitude of platforms that GCC operates (beautifully) on.
Related reading:
Are 64-bit Binaries Really Slower than 32-bit Binaries?
My Sun Ultra 5 And Me: A Geek Odyssey
A general note on benchmarking
- "Intro and GNUZip"
- "OpenSSL 0.9.7c"
- "MySQL 4.0.17 and Conclusion"



