Difference between compilers

This is a discussion on Difference between compilers within the Windows Programming forums, part of the Platform Specific Boards category; OK, I recently ( last hour) installed the C::B IDE, which uses the MINGW compiler. Now I have a question. ...

  1. #1
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189

    Difference between compilers

    OK, I recently ( last hour) installed the C::B IDE, which uses the MINGW compiler. Now I have a question. Ive noticed that teh MINGW provides an option called 'expensive optimizations', what effect does this have on compile time and on speed of the executable?

    Also, Im wondering, since I have access to several different compilers, how do various compilers rate on optimization?
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  2. #2
    Tropical Coder Darryl's Avatar
    Join Date
    Mar 2005
    Location
    Cayman Islands
    Posts
    503
    Most compiler optimizations weigh speed vs size, as far as compilation speed, intuitively I would say it would be longer, but in practice, I have never notice any difference.(but then again, I've never compiled anything that takes hours to build.

  3. #3
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Quote Originally Posted by Darryl View Post
    I've never compiled anything that takes hours to build.
    Longest program ive compiled takes about 45 minutes, but its a couple million lines of computer generated code.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    I think the longest compilation time I've ever had was about a minute for computer-generated code and maybe 30 seconds for hand-written code. That's for my code, though. Compiling the Allegro and Boost took a few hours each.

    OK, I recently ( last hour) installed the C::B IDE, which uses the MINGW compiler. Now I have a question. Ive noticed that teh MINGW provides an option called 'expensive optimizations', what effect does this have on compile time and on speed of the executable?
    Expensive optimizations are optimizations that could speed up your program slightly, but take a long time for the compiler to do.

    Also see GCC's other optimization options: http://www.network-theory.co.uk/docs...cintro_49.html
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  5. #5
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Quote Originally Posted by dwks View Post
    Expensive optimizations are optimizations that could speed up your program slightly, but take a long time for the compiler to do.
    OK, thanks dwks. Thats sort of what i figured it was but wanted to make sure. Ill just leave it on then, since extra compile time is nothing but every last picogram of speed is important.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  6. #6
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    I didn't know this, but -O3 can actually make your program slower.
    -O3
    This option turns on more expensive optimizations, such as function inlining, in addition to all the optimizations of the lower levels -O2 and -O1. The -O3 optimization level may increase the speed of the resulting executable, but can also increase its size. Under some circumstances where these optimizations are not favorable, this option might actually make a program slower.
    You could try -O2 and -O3 to see which works better.
    -O2
    This option turns on further optimizations, in addition to those used by -O1. These additional optimizations include instruction scheduling. Only optimizations that do not require any speed-space tradeoffs are used, so the executable should not increase in size. The compiler will take longer to compile programs and require more memory than with -O1. This option is generally the best choice for deployment of a program, because it provides maximum optimization without increasing the executable size. It is the default optimization level for releases of GNU packages.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  7. #7
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Yeah I saw that. Ill have to keep that in mind if my frame rate drops too low.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Difference Equations / Recurrence Relations
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 10-05-2007, 10:26 AM
  2. What's the difference between var++ and ++var
    By ulillillia in forum C Programming
    Replies: 6
    Last Post: 05-31-2007, 02:27 AM
  3. C++ Builder Comparison
    By ryanlcs in forum Tech Board
    Replies: 14
    Last Post: 08-20-2006, 09:56 AM
  4. Compilers, Compilers, Compilers
    By Stan100 in forum C++ Programming
    Replies: 11
    Last Post: 11-08-2002, 03:21 PM
  5. What is the Difference between ANSI C and non-ANSI C ?
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 11-24-2001, 05:55 AM

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