Archived

This topic is now archived and is closed to further replies.

GCC > MSVC 6 ?

This topic is 5181 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Everyone always says how gcc is slower than the MS or Intel compilers. I assumed that even MSVC 6 would be better than the newest gcc, but it appears that assumption might have been wrong. I benchmarked my chess program using both, and gcc was a hair faster (about 1%). I used -O2 for gcc. Anyone else have a similar experience? Or is this one test a fluke?

Share this post


Link to post
Share on other sites
It really depends on your programming style, and a myriad of other factors. In general, MSVC++''s optimizing compiler (available on the Pro and Enterprise versions of MSVC++) is faster than gcc, at least in Release mode.

You mentioned using -O2 for gcc--what settings did you use for MSVC 6?


How appropriate. You fight like a cow.

Share this post


Link to post
Share on other sites
I tried quite a few. The default release settings, and just about every combination of customized optimization settings that are available.

BTW, how does it depend on one''s programming style?

Share this post


Link to post
Share on other sites
If you need mostly integer optimizations, GCC (3.x) is extremely good at performing them (I don''t know about the newest release of Intel''s C Compiler, but GCC used to out-optimize 6.0 in a lot of hashing algorithms and such). Floating point optimizations still need some work for IA-32 as far as I''m aware, so other optimizers may handle them better. GCC is as good as any compiler at simple optimizations (function inlining, loop unrolling, all of that).

Since you mentioned a chess program, it leads me to believe that you''d be needing light integer optimizations and various generic optimizations, which GCC handled just fine.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
GCC rocks!!
Seriously I''ve been using it for some time and it only seems to get better.. MicroSoft is too busy with .NET, longhorn, and other things which is why I very much doubt they care about optimizing your C/C++ code now or making the compiler any better.. They know you''ll use it even if it''s slower, because it''s made by MicroSoft..
if anything they''ll purposely make it suck worse, so you''ll feel the need to use .NET
Isn''t the new MSVC(7) all about .NET? I wonder why?
Another conspiracy to add to the list?

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
Another conspiracy to add to the list?

Yes. Anonymous Posters are actually "stupid bombs" sent from Mars to infect us all with stupid.


How appropriate. You fight like a cow.

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
GCC rocks!!
Seriously I''ve been using it for some time and it only seems to get better.. MicroSoft is too busy with .NET, longhorn, and other things which is why I very much doubt they care about optimizing your C/C++ code now or making the compiler any better.. They know you''ll use it even if it''s slower, because it''s made by MicroSoft..
if anything they''ll purposely make it suck worse, so you''ll feel the need to use .NET
Isn''t the new MSVC(7) all about .NET? I wonder why?
Another conspiracy to add to the list?

Regardless of how many other things Microsoft is juggling at once, I don''t think any really affects the others. They have a compiler group, and they just work on the compiler. If they decide to embark on something new like web search engines or new versions of Windows, then (suprise!) the compiler group keeps right on working on the compiler.

Regarding my program, yes, it''s pretty much all integer operations. I think I cast a few things to float so they look nice and pretty when displayed

Share this post


Link to post
Share on other sites
I''m not sure which version of gcc. I''ll check when I get home (at work at the moment). It''s whatever came with cygwin when I downloaded it a couple months ago (I think). And it was MSVC 6 pro.

Share this post


Link to post
Share on other sites
Actually my engine is a little faster when compiled with GCC 3.3 than with MSVC++ 2003 (release mode). Not very much, perhaps 1 or 2%, but still. And it's mostly floating point. I guess it really depends on the specific piece of code, but GCC is definitely not bad.

Edit: Ah no, correction: it was GCC 3.2 under Windows.


[edited by - Yann L on October 9, 2003 8:47:22 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hah see even Yann said it''s the bomb.

"(suprise!) the compiler group keeps right on working on the compiler."
And who do you think is working on .NET?.....


Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
Hah see even Yann said it''s the bomb.

"(suprise!) the compiler group keeps right on working on the compiler."
And who do you think is working on .NET?.....

The .NET group. Honestly, could you take your stupid somewhere else?



How appropriate. You fight like a cow.

Share this post


Link to post
Share on other sites
quote:
Original post by Russell
I''m not sure which version of gcc. I''ll check when I get home (at work at the moment). It''s whatever came with cygwin when I downloaded it a couple months ago (I think). And it was MSVC 6 pro.


Try MinGW and MSYS, the stable release uses 3.2.3 and you get executables that dont relly on cygwin libs. . . its what you get with -mno-cygwin, without passing that flag.

Cheers!

Proud aedGUI developer.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Where should I take it sneftel? yo momma''s house?

Share this post


Link to post
Share on other sites
I find all these posts a bit hard to belive, i allways though of VC as the second best compiler available, the intel being the better one.

I guess the results you guys are getting can be true. =) Not calling a liar to anyone. But do check if you''re compiling on release version, check if you have the processor pack, the latest service pack(for VC6, service pack 5), and check if you have the latest platform SDK(Fev 2003).

Then if you get the same results, maybe gcc is better then VC in some cases =).

Share this post


Link to post
Share on other sites
There are also a couple of other optimizations within VC that you can use, like extra cpu instructions and so on.

You may also wish to select that you prefer speed over size.

----------------------------------------------
Petter Nordlander

"There are only 10 kinds of people in the world. They who understand binary and those who do not"

Share this post


Link to post
Share on other sites
quote:
Original post by Kambiz
Compilers Benchmark : http://www.yasrt.org/benchmark.html
MSVC7 > MSVC6 > ICCPP5 > MinGW > CW PIII > LCCWIN32 > DRMARS

That''s the old GCC (2.95, when the newest version is 3.3) used for that "MinGW" test. The new one has a much improved optimizer (also why compile times are a bit higher).

Share this post


Link to post
Share on other sites
quote:
Original post by 255
If MSVC and GCC are about as good then why prefer the expensive one?


because they have a very good ide. I tried many other, free ides, but there was none that came close to ms'' ide

My Site

Share this post


Link to post
Share on other sites
quote:
Original post by quasar3d
quote:
Original post by 255
If MSVC and GCC are about as good then why prefer the expensive one?


because they have a very good ide.

MS opened the VSIP package a couple of months ago. This is an SDK that lets you add support for alternative compilers and languages to the VS.NET IDE. Maybe someone should write a VSIP package that supports GCC?

You can''t make the package open source, though, since the license prevents that. But as long as you are shelling out to gcc.exe instead of linking the GCC source into the package, that shouldn''t be a problem, should it?

--
AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.
[Project site] [Blog] [RSS] [Browse the source] [IRC channel]

Share this post


Link to post
Share on other sites
quote:
Original post by Cypher-PT
I find all these posts a bit hard to belive, i allways though of VC as the second best compiler available, the intel being the better one.
I''ve always heard the exact opposite. That the latest MS compiler edges out the latest Intel compiler. Results probably vary depending upon the application and the hardware.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by 255
If MSVC and GCC are about as good then why prefer the expensive one?


Umm... gcc is just a compiler. MSVC is a compiler, a ton of libraries, half of which you may never even try, the best IDE available in most peoples opinion, extensive documentation, resource editing, updates and support, yadda yadda yadda... need I go on?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I think you have to qualify exactly what version of gcc you''re talking about when you start comparing compiler reputations. A lot of the rap GCC got was from when 2.7.x was getting really long in the tooth while other compilers were advancing. MSVC 6 is 5 years old, and I think the optimization level is only up to, what, Pentium Pro? GCC 2.95 and 3.2, 3.3 are all much newer.

Share this post


Link to post
Share on other sites