On Sun, 23 Jan 2011, Jeremy Hall wrote:
>> MinGW GCC 4.5.2 -Os 173 seconds
>> MinGW GCC 4.5.2 -O3 105 seconds
>> MS Visual C++ 2010 -O1s 89 seconds
>> MS Visual C++ 2010 -O2t 87 seconds
It's well known that GCC's -Os produces *much* slower code in return for
reducing executable size, so if you want to compare the highest
performances of GCC and VC then I would ignore -Os completely.
> Really, I was surprised GCC didn't produce faster code given the effort
> that lots of very clever people put into the optimizer, and you can see,
> in general, the assembler produced is much more sophisticated.
It may be because it's an intermediate language compiler that supports
several source languages other than C++, and several target architectures
other than i386. This may reduce the number of optimisations that it can
apply. It is also mainly developed by volunteers, whereas:
> MS hardly seem to develop VC, it doesn't even support C99 after 11 years,
Windows and most of its software (MS Office, IE, etc) have always been
compiled with VC or its ancestors, and being a commercial product, Windows
always had to be fast. They could make their programmers write bizarre
contortions to get through the compiler, but if that compiler produced
awful code then Windows would suffer in the marketplace.
So they had a business incentive to spend a lot of money on making the
compiler produce really fast code (maybe a long time ago), but they never
really had an incentive to add language features.
It would still be very interesting if you could reduce the problem to a
test case and compare the assembler code generated by the two compilers.
If GCC can be improved then all x86 Linuxes and FreeBSD would benefit as
well, and many people would thank you :)
_____ __ _
\ __/ / ,__(_)_ | Chris Wilson <chris+sig@...> Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Ruby/Perl/SQL Developer |
\__/_/_/_//_/___/ | We are GNU : free your mind & your software |