MinGW vs Visual Studio 2008 output code quality [closed]
A开发者_开发技巧 few days ago I was told that recent versions of g++ produce "better" x86 code than MSVC 2008. Basically GCC with full optimization produces faster applications than MSVC with full optimizations.
While it's certainly correct to state that this, if true, depends a great deal on the application and the C++ code used (and I'm in the process of evaluating this claim for my application), I'm wondering what do others think.
In essence, what have been your personal experiences when comparing the output of these two compilers?
I'm asking about MinGW, but if your experience with vanilla GCC is somehow valid here, feel free to share that too.
My experience is compiling my C++ JPEG-LS image compression project. http://charls.codeplex.com
For me, Visual C++ was significantly faster.
I compiled it mostly with G++ on linux. After a lot of tuning, the G++ version was still about 10-15% slower on the same hardware (the same physical machine, dual booted as linux). That was after many hours of searching for G++ optimization options that actually helped. Just compiling with default optimizations G++ was 60% slower than Visual C++.
My project is perhaps somewhat a-typical because it is not C, but C++ and requires the compiler to do a lot of inlining. On both compilers, I enforce inlining to happen.
Also, it was offered to me as an explanation that the x86 has very few registers, and G++ was not good at allocating them.
Update:
For a more thorough comparison of microsoft and gnu compilers, go to this C compiler benchmark. According to how I read these figures, the difference between Microsoft and GCC for 32 bit are on par with each other, although GCC is tested with profile guided optimization(PGO) and Microsoft isn't (there's no PGO in VS Express).
Without PGO, Microsoft is faster on 32 bit. On 64 bit, GCC is faster. Intel is still faster than either on either platform.
精彩评论