g++ is very slow when compared to cl

This is a discussion on g++ is very slow when compared to cl within the Tech Board forums, part of the Community Boards category; when i compile my .cpp files i feel that g++ is very slow. i thought it was natural since C++ ...

  1. #1
    Banned
    Join Date
    Nov 2007
    Posts
    678

    g++ is very slow when compared to cl

    when i compile my .cpp files i feel that g++ is very slow.
    i thought it was natural since C++ is very complex to compile.
    but when i run cl on same files it compiles much faster.

    are there any options to make g++ run faster. or may be my g++ version is old. although i am using latest MinGW package.

    cl is the name of Microsoft Compiler. I have MSVC .Net 2003 but I use it from command line only!

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Moved to Tech board.

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    The Microsoft compiler is indeed considerably faster than GCC. Since its source is not available, we don't know why that is.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #4
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,243
    Quote Originally Posted by CornedBee View Post
    The Microsoft compiler is indeed considerably faster than GCC. Since its source is not available, we don't know why that is.
    The usual reason for g++ slowness is the speed of parsing the STL code, which is included pretty much everywhere. I'd guess that Visual Studio has precompiled headers for most things, which makes a huge difference. g++ supports them now, sort of...

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    I believe even VS doesn't use precompiled headers for the STL unless you tell it to. Besides, VC++ is faster at compiling complicated Boost stuff, too, and that far exceeds the STL in size.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #6
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    The only thing that interests me is which one of them optimizes better.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  7. #7
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    In general, that prize goes to MS's compiler as well. Though the 4.x series of GCC is considerably better than the 3.x series and is very close, sometimes better.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  8. #8
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Quote Originally Posted by CornedBee View Post
    In general, that prize goes to MS's compiler as well. Though the 4.x series of GCC is considerably better than the 3.x series and is very close, sometimes better.
    Well, I work on a reverse engineering project of an application compiled with GCC and one other guy I know works on the next version of it, which is compiled with MSVC. He said that version had alot worse assembly than the GCC one had... also, there weren't too many new features but the size of the executable grew about 8 times.

    The games are GTA:Vice City and GTA:San Andreas and the reversing projects are VC:MP and SA:MP.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  9. #9
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    *shrug*
    That's the thing about generalizations.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  10. #10
    Banned
    Join Date
    Nov 2007
    Posts
    678
    CornedBee: I did not understand that.

    My g++ was so slow that it took the whole night to compile Qt.
    I left the PC on for the night. And by the morning it was almost done

  11. #11
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,474
    Hmm... that must be some other problem then. I compiled Qt before on my aged laptop, and while trying to decide between it and wxWidgets, and it took me... 30 minutes? Yes, g++.

    I can tell you however mingw's g++ is indeed slower and produces more bloated code than VC++. This became very obvious to me when I started using the wxWidgets framework. However under Linux, the same library compiles considerably faster and with less code bloat. So, it must probably a port thing.

    Regardless I used to use g++ extensively on windows. It's a great compiler, has a good debugger and goes along just fine with all the IDEs we like. I used VC++ specifically only for my wxWidgets project. But now I migrated to Linux, and am considering moving the wxWidgets project too, since my preliminary observations revealed g++ there to be as good as VC++ is on windows.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  12. #12
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Quote Originally Posted by Mario F. View Post
    I can tell you however mingw's g++ is indeed slower and produces more bloated code than VC++. This became very obvious to me when I started using the wxWidgets framework. However under Linux, the same library compiles considerably faster and with less code bloat. So, it must probably a port thing.
    How can you tell that? Have you examined some disassembly?
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  13. #13
    Banned
    Join Date
    Nov 2007
    Posts
    678
    Mario: I have also compiled some plain C++ programs with g++. Even the simplest "Hello, World" type takes so much time, that i can more than just notice the time taken.

  14. #14
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,758
    Mario: I have also compiled some plain C++ programs with g++. Even the simplest "Hello, World" type takes so much time, that i can more than just notice the time taken.
    That is definitely unusual. What are your system specs, and what version of g++ are you running?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  15. #15
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,627
    But Visual Studio 2003 is quite outdated. The least you should be using is 2005, since it's considerably more standards compliant. Best use 2008, though. It's even more standards compliant.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Page 1 of 4 1234 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. CL and C++
    By siavoshkc in forum C++ Programming
    Replies: 1
    Last Post: 09-24-2006, 03:01 PM
  2. Program is slow. Help
    By jjj93421 in forum C++ Programming
    Replies: 14
    Last Post: 08-08-2004, 07:39 AM
  3. slow game
    By lambs4 in forum Game Programming
    Replies: 2
    Last Post: 08-21-2003, 02:08 PM
  4. Solutions for slow performance?
    By Hunter2 in forum Game Programming
    Replies: 52
    Last Post: 08-24-2002, 10:04 AM
  5. slow load of Cprog.com
    By Generator in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 10-13-2001, 06:31 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21