Author Topic: Compiler World  (Read 4391 times)

Offline Roman

  • Multiple posting newcomer
  • *
  • Posts: 78
Compiler World
« on: May 06, 2006, 11:19:18 am »
Guys, I am a bit interesting in how different compilers do the job (performance issues and so on).
I think i am not alone :)
May be someone knows the place (forum or sth.), where such a things are discussed?
CB LSI (C::B as a Little Secret Initiative)

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: Compiler World
« Reply #1 on: May 06, 2006, 11:31:38 am »
There is always google: http://www.google.gr/search?q=compilers+comparison
If you can speak greek there's a nice discussion here.
Life would be so much easier if we could just look at the source code.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Compiler World
« Reply #2 on: May 06, 2006, 01:56:25 pm »
Compiler performance comparisons are quite pointless in any case. Most modern compilers perform widely the same if used correctly. Benchmarks do not tell you anything, they are a mere waste of your time. Opinions and discussions even more so.

For example, there are several benchmarks on the internet which are favourable towards MSVC or DM, stating that these produce 20-30% faster code than gcc. However, they compare the most recent versions of these compilers to a 5 year old competitor mostly in artificial benchmarks, and things like this.

If you look at the Crypto++ benchmark which compares around 3-4 dozen real life cryptographic algorithms, you will see that MSVC outperforms gcc by 30-50% on some algorithms, on some others, they are nearly identical, and yet on others, gcc is up to 50-60% faster. This shows how much performance depends on the actual algorithm and coding.
Apart from that, the choice of algorithm has a much higher impact, as can be seen from a recent post on this forum. A user compiled a program that makes heavy use of the STL with MSVC and then switched to gcc. Suddenly, the program performed 2600% faster. The only parameters that had changed were the compiler and the STL implementation. Thus, one can see how large the impact of a slightly different algorithm can be.

If you have to decide for a compiler, you should do so following simple, practical questions:
1. What do you target?
If you only ever intend to program Windows and Windows-specific stuff, then MSVC will be a good choice. If you ever plan to port your programs, it is a lousy choice. If you ever plan to compile on something else but x86, you will probably want gcc, too.
2. Do you need dirty old C or strict C++? Maybe even D?
If you give a **** about standards compliance, then any compiler will do. If you need a compiler that is as complicant as can be, then you want Comeau (commercial) or gcc (free). However, the latest version of MSVC is not so bad, either.
3. Are you willing to pay money or not?
4. Gcc takes significantly longer to compile and link a program. Do you need extremely fast compile and link times? Then you want DM. If it does not matter too much, then either one is good.
5. Many other things... :)
« Last Edit: May 06, 2006, 01:58:26 pm by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Roman

  • Multiple posting newcomer
  • *
  • Posts: 78
Re: Compiler World
« Reply #3 on: June 16, 2006, 01:35:04 pm »
You are perfectly right about all including timewaste, but i wanna a good compiler, which can optymize better than me. Now it is impossible, but i wanna be aware of situation.

Best Wishes
CB LSI (C::B as a Little Secret Initiative)