views:

59

answers:

2

Are there any compilers in use that pay little attention to compilation speed but rather seek maximum optimization even at an order(s) of magnitude compile time slow down?

It seems to me that having a compile take hours/days vs minutes/second wouldn't be a major issue once you get very near the final release. (And if you have enough tests, it should be safe to.)

+1  A: 

To some extent they are "slow", its just that the computers are so fast and possessed of such voluminous memory that you don't notice like you used to...

::Runs off to do a little experiment with g++::

Picking a slightly mathy code I wrote for work I get (about 24k LOC in c++ in 75ish files making heavy uses of the ROOT libraries, but no templates)

  • -O0: 8.88 seconds
  • -O4: 13.60 seconds
  • -Os: 11.32 seconds

Hmm...doesn't add up to a large fraction of the compile time. Perhaps it's just dominated by file access time. Maybe I should try it with mplayer or something else real intensive.

dmckee
+2  A: 

Actually, yes. Not because the optimizer is slow, but rather because what you ask the optimizer to do is something that, of necessity, takes a long time. For example, I use LLVM to optimize whole programs: The source files that have been compiled as well as all the libraries that the source files use. Everything is linked as intermediate code and optimized together. This optimization is noticeably slower than linking separately optimized object files. But I don't care, for two reasons: 1, Optimization is done over the whole program and that is worth the wait (;-) and 2, Computers get faster all the time.

Richard Pennington
I'm not asking why they are slow, but why they aren't slower? I have the CPU, why not use it?
BCS
I'm saying you can. In my case, extreme optimization (TM) may mean the program can run on a pic32 with no external storage. Most people with 3Ghz processors and "unlimited" storage don't really care to wait for the optimizer to save them time/space.
Richard Pennington
What kind of slow down do you see? 10x?
BCS