Tuesday, October 09, 2007

Compilers

I've been playing with sysbench on Solaris SPARC lately and... it surprised me how big difference compiler can make - ok I haven't been trying all the options but still...
So lets look at sysbench/cpu test - what is a difference if sysbench was compiled using gcc version 3.4.3 (-O2, -O3 basically produces similar results) vs Sun Studio 12 (-fast)


It is about 7x performance difference!

But lets look into memory test and I get mixed results - with one thread cc produced faster code, with more threads it produced slower one.


It's possible that after tweaking gcc parameters one could get similar performance to sun studio compilers (or vice verse in mem test) however people tend to compile applications with basic parameters usually. I wouldn't expect such big difference between these two compilers with larger applications... but you never know.

I'm not going into any holy-compiler wars - it's just that sometimes one can be surprised.

3 comments:

  1. Have you done any tests with 'gcc for sparc servers' (http://cooltools.sunsource.net/gcc/index.html)?

    I'd be interested to see the comparison alongside the two you've done.

    ReplyDelete
  2. I've *generally* found studio to produce faster sparc code than gcc, and it's been like that for as long as I can remember. On x86 it's usually a wash. If cpu time is important it's always worth spending a little time to try both and see how it goes. Like you, I'm often surprised by the results.

    ReplyDelete
  3. Sometimes I've actually seen gcc outperform studio on US-II with open source graphic libraries - I was surprised again :)

    ReplyDelete