Slashdot Mirror


Comparing Linux C and C++ Compilers

ChaoticCoyote writes "I've posted a comparison of recent GCC versions (3.3, 3.4, and the coming 4.0) with Intel C++ 8.1, including several benchmarks and "state-of-the-product" reviews. The new article replaces an older piece I published in late 2002. This new comparison marks what I hope will be an ongoing series that tracks the quality of Linux compilers."

99 of 379 comments (clear)

  1. gcc! by dosius · · Score: 4, Insightful

    well, GCC has one thing going for it - it's open source - and that's why I'm sticking with it. XD

    FP?

    Moll.

    --
    What you hear in the ear, preach from the rooftop Matthew 10.27b
    1. Re:gcc! by Anonymous Coward · · Score: 5, Informative

      GCC has other things going for it, too.

      ProPolice stack smashing protection patches for one. (and many others besides.)

      And cross-platform compatability. I can compile for targets. Like working on embedded products.

      Oh, and Distcc for realy big projects to get compiled quickly using easy to setup clusters.

      It's "correctness" is pretty high up their, too.

      Remember, for Unix:
      compatability, portability, flexibility > speed.

      If all you ever have to worry about is x86, then it's not that big of a problem, but for anything else there is no comparision to GCC that I am aware of.

      That it having it free software rocks.

    2. Re:gcc! by multipart · · Score: 2

      Sorry but... ProPolice sucks.

      Nobody cares about stack smashing protection anymore these days. Besides, GCC 4.0 has libmudflap and -fmudflap for C and C++. While this isn't exactly the same as stack smashing protection, it is still very effective and much more efficient.

      It's not entirely without reason that IBM still hasn't posted ProPolice for inclusion in the FSF GCC mainline. The patch against SUSE's hammer branch has been floating around literally for years, but they know really only very few people truely believe it makes a difference.

      And you might want to try IceCream instead of distcc. It's pretty, it's fast, it's hetrogeneously mutliplatform, and it's free software too.

    3. Re:gcc! by antifoidulus · · Score: 4, Insightful

      Yeah but how important is ultra-high performance for you? If you are in charge of a multi-million dollar super computer, I would hope that you wouldn't say, "Well, I can get better performance out of this commerical compiler, but I disagree with commercial software, so I'll use open source"
      My view on the whole open-vs-closed debate is whatever gets the job done. There are a lot of open source tools that get the job done quite well, and I use those. But there are also occaisions where proprietary software gets what I need done quicker and easier, so I'll use that.

    4. Re:gcc! by k4_pacific · · Score: 4, Funny

      In other words, you can compile GCC with the Intel compiler, but not the other way around.

      Seems like there's an "In Soviet Russia" joke in there somewhere.

      --
      Unknown host pong.
    5. Re:gcc! by UnderScan · · Score: 5, Informative

      Nope, no troll.
      Icecream is created by SUSE and is based on ideas and code by distcc. Like distcc it takes compile jobs from your (KDE) build and distributes it to remote machines allowing a parallel build on several machines you've got. But unlike distcc Icecream uses a central server that schedules the compile jobs to the fastest free server and is as this dynamic. This advantage pays off mostly for shared computers, if you're the only user on x machines, you have full control over them anyway.

    6. Re:gcc! by Billly+Gates · · Score: 2, Informative

      Well unless the benchmark is not good, the icc was not faster than gcc and was slightly slower and had much larger binaries.

      I was supprised to see that.

      Maybe on a risc platform I could see buying a proprietary compiler.

    7. Re:gcc! by vadim_t · · Score: 4, Informative

      I don't know what's up with distcc, but every time I try it, it ends failing at some point. For example a few days I was installing Gentoo, with CFLAGS having -fstack-protector, and distcc crashed somewhere in the bootstrap due to the stack protection. I didn't figure out if it's some kind of conflict, or the stack protector kicked in due to a bug.

      I also heard reports from people about Gentoo not completing the basic installation when trying to do with with distcc even without the stack protector.

      The idea itself is really nice, but at least for me doesn't seem to work nearly as well as it should.

    8. Re:gcc! by niteice · · Score: 2, Funny

      In Soviet Russia, GCC compiles YOU! (obligatory)

      --
      ROMANES EUNT DOMUS
    9. Re:gcc! by vadim_t · · Score: 2, Interesting

      Definitely a troll.

      I googled a bit to take a look at this mudflap thing. While it looks interesting, the system looks considerably more complicated than -fstack-protector and should be noticeably slower too.

      If I understood correctly, -fstack-protector simply adds a guard value and checks it hasn't been overwritten. The performance overhead is minimal. On the other hand, mudflap does some rather intensive checking that involves things like lookup tables, which obviously has to take more time than checking if a the guard value is still what it should be.

      According to this PDF, mudflap can have a really high performance penalty in bad cases. The performance section is rather short though, so it's not very clear what gets slowed down the most.

    10. Re:gcc! by Xabraxas · · Score: 4, Insightful
      Sorry but... ProPolice sucks.

      Why?

      Nobody cares about stack smashing protection anymore these days.

      OpenBSD

      Hardened Gentoo

      GCC 4.0 has libmudflap and -fmudflap for C and C++. While this isn't exactly the same as stack smashing protection, it is still very effective and much more efficient.

      Last time I checked GCC 4.0 wasn't stable.

      It's not entirely without reason that IBM still hasn't posted ProPolice for inclusion in the FSF GCC mainline. The patch against SUSE's hammer branch has been floating around literally for years, but they know really only very few people truely believe it makes a difference.

      That's crap. Propolice does exaclty what it is supposed to do. It doesn't protect against all stack smashing attacks but no one ever claimed that it did.

      --
      Time makes more converts than reason
    11. Re:gcc! by Xabraxas · · Score: 3, Informative

      I thought in the docs it says not to use distcc for the bootstrap process. Perhaps I am wrong but I thought I remember seeing that. Then again, it's been quite a while since I've installed Gentoo. Distcc works fine for me after installation though.

      --
      Time makes more converts than reason
    12. Re:gcc! by Sipos · · Score: 4, Insightful

      It seemed to be surprisingly fast in these benchmarks. Did you see the size of the icc binaries. I am not sure what the options for icc mean but I guess they must be doing loop unrolling/peeling and aligning functions to improve the cache useage. If you enable these on gcc you can gain a huge increase in performance (at the expense of larger code size). It may well be able to produce faster binaries than icc for the same size in many of the tests.

    13. Re:gcc! by EmbeddedJanitor · · Score: 2, Informative

      Contrary to popular opinion, x86 only make up less than half of Linux machines. Most Linux devices are embedded systems running on ARM, MIPS, PowerPC etc which, I'm sure, the Intel compiler does not support.

      --
      Engineering is the art of compromise.
    14. Re:gcc! by ken_i_m · · Score: 5, Informative

      The gcc is not a linux compiler. The g stands for Gnu. The linux kernel and the systems built around it are most often compiled with the gcc. The gcc existed long before Linus's first kernel release.
      --
      ken_i_m
      Founder, Bozeman Linux User Group

    15. Re:gcc! by adamwood · · Score: 5, Interesting

      Erm. If you look at the current top500 you'll see that there's a Xeon machine in the top 5.

      Have you actually tried other platforms? The best compiler on a given architecture is usually the chip vendor compiler -- IBM's compiler beats GNU on PPC 970, HP's beats GNU on Alpha, etc.

      Sure you can find the odd piece of code where Gnu will beat vendor compilers but overall, and particularly for large scientific workloads, vendor compilers win for raw speed.

    16. Re:gcc! by bit01 · · Score: 4, Insightful

      "is $x > $y?"

      This is only true if you include all costs and benefits, not just the sticker price.

      Commercial vendors would love for customers to consider only the sticker price without taking into account the many hidden and recurring costs in most commercial software solutions.

      ---

      Astroturfers are scum.

  2. 3.5 vs. 4.0 by slavemowgli · · Score: 3, Interesting

    Interesting. Something I don't understand, though, is why the article talks about both gcc version 4.0 and "the upcoming-3.5"; will there be a 3.5 version before 4.0, or is that simply a typo?

    --
    quidquid latine dictum sit altum videtur.
    1. Re:3.5 vs. 4.0 by kristofme · · Score: 5, Informative

      The current version of GCC is 3.4.2, and the next planned version will be called 4.0.0
      More info on the GCC site

    2. Re:3.5 vs. 4.0 by Aardpig · · Score: 3, Informative

      I'm not sure, but I'd guess that 4.0 is the place where major development is happening, where major changes/improvements are made, whereas 3.5 is where minor/incremental stuff is being done.

      I'm afraid you're wrong. 3.5 is the current development version of GCC. Amongst other things (which include a new Fortran 95 frontend -- hurrah!), it uses a wholly-new optimization architecture known as 'Tree-SSA'. This change is so radical that it was recently decided that 3.5 should actually be released as new major revision -- i.e., 4.0 -- rather than as 3.6 (recall that many open source projects use odd minor version numbers for development branches, and even ones for stable releases). Therefore, 4.0 is what 3.5 will be once it is released as stable.

      You may recall that a similar version renaming was mooted for the latest Linux kernel, but it was decided to leave it as 2.6 rather than 'upgrading' it to 3.0.

      --
      Tubal-Cain smokes the white owl.
    3. Re:3.5 vs. 4.0 by ChaoticCoyote · · Score: 5, Informative

      The GCC Steering Committee changed the next version of GCC from 3.5 to 4.0 while I was in the midst of writing the article. I missed changing a reference; the typo is now fixed.

    4. Re:3.5 vs. 4.0 by FullMetalAlchemist · · Score: 5, Interesting

      Tree-SSA is not new, it's new to GCC but the concept of Single Static Assignment itself is ancient and using it for optimizing trees in not new.
      The problem is the GCC codebase is so badly designed it takes major changes to many parts to introduce a very old concept of SSA into it. So you can't take advantage of a generic SSA but have to introduce different patches for the system.

      Back in my university days we did SSA in our own compilers, for a 5 week course! GCC needs a complete rewrite or a switch to something like TenDRA, which right now produces good solid code, but not extremely optimized machinecode. On the other hand TenDRA is really well designed so it would catch up really fast if more people worked on it.

    5. Re:3.5 vs. 4.0 by multipart · · Score: 3, Informative

      I would certainly hope there will not be a GCC 3.5 created by someone else. Can't think of any reason to, really.

      From GCC 3.3 onward, almost all development of GCC was centered around the tree-ssa project (the new optimization framework for GCC 4.0) and even though bits were in GCC 3.4 (unit-at-a-time for example), there really isn't any major new functionality in GCC 4.0 that is easily backported to GCC 3.4 that would suddenly make it different enough to call it GCC 3.5

      And even new major functionality doesn't mean one has to give a new GCC its own version number. If you look at the SUSE compilers from SUSE 9.0 and later (based on the hammer branch), they claim to be GC 3.3 based, but they're more like GCC 3.4 without the new C++ front end.

      RedHat had to do gcc-2.96 because GCC 3.0 was so awfully overdue and they had customer contracts to satisfy. They gave it a new version number because the C++ ABI it implemented had changed from 2.95. The problem was that the ABI was also not the same as the one implemented for GCC 3.0. That basically caused all other linux distribition to be binary incompatible with RedHat. That caused some hard feelings...

  3. Re:GOT IT! by neil.pearce · · Score: 4, Informative

    by default, gcc (with a .c or lang-spec set to c)
    let's you forget the #include, and the missing return value

  4. I don't get it... by ameoba · · Score: 3, Funny
    He claims to be running AMD64 Gentoo on a P4.

    Tycho (Homebrew)
    Dual Boot: Windows XP Professional
    Gentoo AMD64 GNU/Linux, kernel 2.6 SMP
    2.8GHz Pentium 4 w/HT, Intel D850EMV2, 533MHz FSB
    2x80GB Maxtor D740X 7200 RPM ATA-100 HD
    512MB PC800 RDRAM
    Radeon 9200 Pro, 128MB, NEC FE990


    That doesn't seem right; I know that Gentoo is able to adapt itself to your hardware, but this is a bit much for me to swallow.
    --
    my sig's at the bottom of the page.
    1. Re:I don't get it... by ChaoticCoyote · · Score: 4, Informative

      It's called a "typo". Fixed.

    2. Re:I don't get it... by strider44 · · Score: 2, Insightful

      So let me get this straight. You are attacking the writer for saying that that is a typo instead of a mistake? You, sir, are pedantic.

      But let me for a second play your game.

      Technically, by dictionary, a typo is "An error while inputting text via keyboard, made despite the fact that the user knows exactly what to type in. This usually results from the operator's inexperience at keyboarding, rushing, not paying attention, or carelessness."
      This means that should you accidentely type something totally different by habit or just thinking of something else, this will also classify as a typo under the definition of the world, for example typing "Gentoo AMD64" instead of "Gentoo x86" because he was copying the same format as above.

      Unfortunately you have just assumed that he made a mistake, that he literally thought that he had the AMD64 version installed on his computer, and thought "I knew there was something wrong with that", or he thought that Pentiums were a special class of Athalon 64. That would be classed as a mistake.

      Don't you know what they say about assuming: "don't assume or you'll make an arsehole out of yourself", or something like that. I say similar things about being pedantic as well.

  5. apples and oranges by benasselstine · · Score: 2

    Does the Intel compiler support any other chip architectures other than Intel architectures?
    Hmm?

    --
    My other car is a slashdot UID.
    1. Re:apples and oranges by Sivar · · Score: 2, Funny

      Yes, of course.
      As you know, Intel is very eager to improve performance of processor architectures that are competing with their own.

      --
      Computer Science is no more about computers than astronomy is about telescopes. --E. W. Dijkstra
    2. Re:apples and oranges by PhrostyMcByte · · Score: 3, Informative

      ICC7 would compile to MMX/SSE that works on Athlon XP's just fine, but they changed that in v8 so it'll die on any non-Intel cpus.

    3. Re:apples and oranges by Jeff+DeMaagd · · Score: 3, Interesting

      Are there any figures as to what proportion of Linux computers are x86?

    4. Re:apples and oranges by MonsterChicharo · · Score: 2, Insightful

      Unless you are targeting for binary compatibility among different architectures, the question is somewhat meningless. If you need to compile from the source, you may very well use a faster tool for the job; it can be Intel for Pentiums, and GCC for the rest.

      Granted, if you want to deliver a binary that runs on other platforms (by means of emulation or whatever) you better stick to GCC. Now, how many times do you need this?

      I believe the author of the article himself is stating that in the end you should be using the best tool for the job. So there.

    5. Re:apples and oranges by Anonymous Coward · · Score: 4, Informative

      This isn't true: V8.0 works fine on Athlons.

  6. reverted by Satai · · Score: 2, Informative

    At work we (well, I admin and made the call) reverted from the 8 series of intel to the 7 series because of some issues with fortran 90 compilation, but I hadn't noticed the 8.1 release. I'll have to give it a shot...

  7. Binary size by Guidlib · · Score: 3, Interesting

    Interesting that ICC seems to create consistently quite large binaries in comparison to GCC.

    1. Re:Binary size by multipart · · Score: 4, Informative

      This mostly comes from specializing loops and jumps. ICC does aggressive loop versioning (even including runtime CPUID checks) and, especially with profile feedback (not tested in this benchmark, unfortunately) ICC will try aggressively to try cheap alternatives before trying the generic approach. Think about expensive instructions such as divides and indirect jumpes here. GCC doesn't do that.

    2. Re:Binary size by Xabraxas · · Score: 3, Insightful
      Yeah... and faster code most of the time, too, in spite of it. Memory is cheap these days (512M DDR400 = $73, 80G HDD = $50).

      Who cares about memory when hard drives are so slow? Reading from laptop HDs is especially painful and binary size does come into play.

      --
      Time makes more converts than reason
    3. Re:Binary size by Jthon · · Score: 2, Insightful

      Maybe, or by expanding the loop you just induce a bunch of cache misses which hurt performance more than the couple extra instructions to check a loop variable. In today's world memory is an order of magnitude slower than today's processors. By not unwinding the loop you get the benefit of the temporal locality. Of course the n copies of the loop may be fetched in one memory access. It all comes down to how many blocks are fetched by the cache for a miss, vs size of the unwound loop. If all n copies are fetched in a miss you win. If it takes n memory accesses instead of 1, you lose.

    4. Re:Binary size by psetzer · · Score: 2, Interesting

      Don't underestimate the importance of a full pipeline. If you can avoid a bubble in the pipeline at any cost, odds are you would want to do so. That's one of the beauties of predication in a processor architecture. Although I'm sure that there's some way to make an instruction a whole frigging cache line long, that's more an exercise in perversity than a practical limitation if you don't unroll your loops too much. I could see a series of instructions being like that, though. If you're just adding an array of four numbers to another array of four numbers, then unrolling is the only sane choice. If it's two arrays of 100 numbers, then you should do some testing based on how big the instruction cache on your processor is. If it's a combined cache, then you might see a really substantial drop. As always, profile, profile, profile.

      --
      "Anyone who attempts to generate random numbers by deterministic means is living in a state of sin." -- John von Neumann
    5. Re:Binary size by IamTheRealMike · · Score: 2, Insightful
      Memory may be cheap but the increased performance gained from optimizing for code size isn't negligable.

      In particular small code can make apps start faster, and the whole computer feel more responsive. The day computers never swap and disk I/O isn't a bottleneck will be the day we can ignore code size in compiler benchmarks.

  8. Performance isn't everything. by acceleriter · · Score: 5, Insightful

    Even if the Intel compiler is faster, it's best not to get in the habit of becoming locked into any proprietary platform. How likely is it that features on which one could come to depend will be kept available on free platforms, much less future processors not made or controlled by Intel?

    --

    CEE5210S The signal SIGHUP was received.

    1. Re:Performance isn't everything. by Guidlib · · Score: 2, Insightful

      I'm certain that if there was some quirk that seperated ICC from other compilers that you just loved abusing, that it still wouldn't be terribly hard to make the few changes required to move to another compiler down the track. That's the beauty of using a language like C. So long as you conform to the standards in your code, you should be fine wherever you go. It seems almost like scaremongering to make the suggestion in the parent post.

    2. Re:Performance isn't everything. by Anonymous Coward · · Score: 2, Insightful

      So when the purveyors of proprietary software engage in FUD against Free Software, that's marketing, but when OSS folks point out the drawbacks of imprisoned software, that's "scaremongering?"

    3. Re:Performance isn't everything. by tetromino · · Score: 3, Informative

      it's best not to get in the habit of becoming locked into any proprietary platform. How likely is it that features on which one could come to depend will be kept available on free platforms
      And how likely is GCC to continue supporting the features you love? In case you haven't been checking, gcc-3.4 has removed some of its extensions to C grammar (the old joke used to go that gcc can accept a perl script as valid input). I use Gentoo, and after gcc-3.4 was released, I frequently encountered programs that refused to compile with 3.4. If anything, proprietary software (especially Microsoft's) tends to emphasize backwards compatibility over all other considerations.

      If gcc-4.0 makes your source unusable, will you patch the compiler? How long do you think it will take you to familiarize yourself with the source enough to figure out where the undesirable changes were made?

    4. Re:Performance isn't everything. by doomdog · · Score: 2, Insightful

      How is using an Intel compiler locking you into a proprietary platform? Well-written code can be run through any compiler -- your main cost in switching compilers is figuring out the correct command-line switches, since they're all different...

    5. Re:Performance isn't everything. by Screaming+Lunatic · · Score: 5, Insightful
      Even if the Intel compiler is faster, it's best not to get in the habit of becoming locked into any proprietary platform.

      That is why it is important to compile your code using multiple compilers. Prefer to write code to the C/C++ standards rather than to a particular compiler's idiosyncracies, GCC included. Different compilers also emit different warnings, helping one find bugs sooner.

    6. Re:Performance isn't everything. by fitten · · Score: 3, Interesting

      Different compilers also emit different warnings, helping one find bugs sooner.


      You can say that again. We had a bug recently in some code that gcc compiled without any warnings or problems but the code didn't work right. Compiled it with another compiler and got a warning in the code, looked at it, and sure enough, that was a legitimate bug. Corrected that line of C, recompiled on that compiler and gcc and both executables worked.

    7. Re:Performance isn't everything. by ky11x · · Score: 3, Informative

      Not true at all. Every compiler has specific extensions that are not implemented in other compilers, and they are support different parts of the standard with different levels of compliance. Template support for C++, for example, is different on every compiler, so there is a lot of cost in switching compilers if you have a large codebase.

    8. Re:Performance isn't everything. by psetzer · · Score: 2, Insightful
      In any complex system, I'd doubt that even the gods could work on it. Some days to me, it seems that programming isn't a science, but a random walk. Some changes screw things up, and the program won't even run after they're implemented. Others make the whole program work quicker and more efficiently. What we do is get rid of the bad changes and add the good ones. Open source means in the long run that there will be more changes, but thankfully, if the people working on it care about the end product, then the program will get better quickly since the good changes will be kept and the bad ones culled.

      No matter how good you think you are, and you may be one of the best, for all I know, compile time optimizations are often truly hairy, and sometimes the implementer doesn't even understand why they work. There's an old trick about how to add two 64-bit numbers in a computer with 32-bit registers in only four instructions. You can tell it to anyone, but the important thing is 'do they understand it?' If not then it's of little to no use in a properly written program. Otherwise, it's a neat little assembly trick taking advantage of the fact that a fairly complex algorithm for the carry bit can be broken down into one instruction.

      Algorithms used to speed compiled code are much more complex than that one instruction. Changing them significantly without understanding them at all is stupid. You are lucky if it breaks cleanly. Otherwise, your fix may be around to haunt you for years to come.

      --
      "Anyone who attempts to generate random numbers by deterministic means is living in a state of sin." -- John von Neumann
    9. Re:Performance isn't everything. by smcdow · · Score: 3, Insightful

      Prefer to write code to the C/C++ standards rather than to a particular compiler's idiosyncracies, GCC included.

      Nonsense. GCC has way too many extremely useful "idiosyncracies" to abandon. If you don't know what they are, then you aren't paying attention.

      Better that other compiler makers mimic GCC's behavior. Better still is for the standards groups to adopt GCC as the reference standard for C and C++ compilers.

      --
      In the course of every project, it will become necessary to shoot the scientists and begin production.
    10. Re:Performance isn't everything. by stonecypher · · Score: 2, Informative

      That's funny: my templates, which are written to the C++ standard, work just fine under GCC, SCC, ICC, Comeau/EDG-based compilers like MSVC and BCC, and so on. Rather than make claims that things vary from compiler to compiler, why not show us some examples?

      --
      StoneCypher is Full of BS
  9. You can run intel binaries on opteron by DMC_DMC_DMC · · Score: 2, Informative

    32 bit intel binaries will run on an Opteron and will probably give some gain as seen here at Aces.
    Aces article

  10. I am dissapointed in Intel by Billly+Gates · · Score: 4, Interesting

    I hear people complain about gnu C++ alot because its not as good as commercial compilers.

    However from what I see is the performance of the compiled code is the same with the exception that the resulting binaries are alot bigger.

    Maybe gcc is good on x86 but sucks on other architectures? I know the Sun and SGI geeks have complained for years that gcc does not run well on their platforms compared to expensive alternatives by their vendors.

    Has anyone run ICC and VC++.net on Windows? How does it compare to Borland and MS compilers under Windows2k?

  11. Vectorization? by r6144 · · Score: 4, Interesting
    On some numerical tests icc seems to give twice faster code than gcc, and I think it is probably due to icc's automatic vectorization (the difference in almabench is said to be mainly due to the superior software SSE-based sin() and cos() functions used by ICC, correct me if this is wrong).

    I think the author had better mark the tests whose inner loops have been vectorized, since while some algorithms are easily vectorizable, some are not, so the performance of both are interesting. After all, we care most about the features (such as automatic vectorization) of the compiler, while benchmarks only very roughly reflect the existence of such features, the applicability of them, and their effects.

    1. Re:Vectorization? by ChaoticCoyote · · Score: 5, Informative

      GCC 4.0 (which is, of course, "in development") has recently included automatic vectorization -- another of the "good things" that will be coming with the new architecture.

      My next article will compare automatic vectorization and profiled optimizations.

  12. Re:I don't get it... that you don't get it... by Coryoth · · Score: 3, Informative

    For the people here not getting his point:

    AMD64 kernel
    Intel P4 processor

    Sure you can compile for AMD64 for if you like, but if your processor is an ordinary Intel Pentium 4 you probably won't be getting many benefits from doing so.

    As some of the more insightful people have pointed out, there is a difference between mcpu=x86-64 which will make optimaztions assuming amd64 architecture (which is just silly, as you'll get no gains from it on a Pentium chip), and march=x86-64 which breaks binary compatability and just won't run on a Pentium.

    So, either he's stupid and optimized for a CPU he doesn't have, or he is horribly incorrect about that configuration he specified, because it wouldn't be running. Take you pick.

    I hope that clarifies things.

    Jedidiah.

  13. C++ compile times? by tetromino · · Score: 2, Insightful

    One of the main reasons I was looking forward to the new GCC versions was faster compile times for C++. Yet it seems that for povray (the only c++ source in the benchmark), the compile times consistently get worse with newer versions of gcc. Does no-one care about people who actually compile kde?

  14. Re:Not a lot of selection for Linux compilers, eh? by tomstdenis · · Score: 5, Insightful

    Actually there are. LCC and TinyC come to mind. They're not used much in production [well LCC was reborn as LCC-Win32 for a while] but really GCC is the better choice.

    The problem with the "good old days" was that as my friend Dave Dunfield said once "C compilers are a dime a dozen".

    Just because you had a dozen C compilers for your 8086 doesn't mean you were better off. In fact most compilers for the 86 were crap [e.g. smallC, byteC, Zortech, paradise, etc...]. In fact the only half-way decent 86 compilers I recall are Turbo C [v3.01 was ok] and Micro-C [by Dave Dunfield so maybe I'm a bit biased there...].

    Note I'm not saying more compilers is bad. The problem is like any field "new" doesn't imply better. You have to tackle problems and answer them.

    For instance, GCC is rather large and can be slow/memhog on some files [C++ in particular]. A viable competitor for Linux would be one which optimizes decently while not being such a hog. It could pitch in when you can't build a file [say from VisualBoyAdvance which requires ~1GB of ram to build with GCC 3.4.2]...

    For the most part though, contributing to GCC makes more sense than writing your own compiler. First off, GCC is a "standard". So you're likely to get a huge audience that way. Second, GCC is already well established. It's a very good suite of tools and frankly hard to compete with. Third, you'll save a lot of time.

    For all intents and purposes you could change your argument to why do "linux" boxes only run the Linux kernel? I mean for all intents and purposes you could write your own kernel that was interoperable and use instead. For the same reason why contributing to GCC is a good idea so is contributing to the kernel [instead of writing your own] is a good idea.

    One last caveat before I send this post. I do agree though that writing such said tools [kernels or compilers in this case] are a good idea for educational purposes. It means a lot to know how to write a functional [and ideally half-way decent] compiler even if it only targets one platform and covers only part of a language. :-)

    phew...

    Tom

    --
    Someday, I'll have a real sig.
  15. Re:Not a lot of selection for Linux compilers, eh? by Waffle+Iron · · Score: 2, Insightful
    You know, it seems there were far more compilers available for DOS and OS/2 than are available for Linux.

    That's most likely because the market for compilers has become more mature. There are usually fewer players left in a mature market than in a new one. It doesn't necessarily have anything to do with open vs. closed source.

  16. This guy must be a nerd... by Isldeur · · Score: 5, Funny


    You can tell this guy is a nerd, but it goes far beyond the pizza and mountain dew... Is that really an empty tub of frosting sitting my his computer?? :)

    1. Re:This guy must be a nerd... by ChaoticCoyote · · Score: 5, Funny

      Yes, it is frosting. Chocolate frosting. How else can I maintain my svelt figure?

    2. Re:This guy must be a nerd... by SirTalon42 · · Score: 2, Funny

      You need more empty soda cans on ur desk to call urself a nerd! I got 6 cans, plus 3 bottles of water (resently threw them all away)!

    3. Re:This guy must be a nerd... by ChaoticCoyote · · Score: 3, Insightful

      Wolfram has some interesting points, but I think his ego has gotten in the way of good science. With his "New Kind of Science", Wolfram hasn't really "invented" anything; he's mostly implying meaning where it may or may not exist.

      On the other hand, I do believe that higher order derives from basic, simple, underlying processes that combine in great complexity. Turning that supposition into real science is something I hope to see happen in the next century.

  17. Re:illogical hostility? by ChaoticCoyote · · Score: 4, Insightful

    The hostility mystifies me. I'm a semi-active participant in the GCC mailing list, and the people who work on GCC are very helpful, open, and communicative. Some even thank me for my QA efforts.

    I don't see that my article is negative about GCC; in fact, I'm very clear that Intel's compiler isn't a replacement for GCC, and that GCC is a fine product. Maybe the complainers can't read?

  18. Re:Mod up!! by tetromino · · Score: 2, Funny

    Billy Gates is asking why a comment insulting open source was modded -1?

    This is a classic...

  19. commercial thinking by foog · · Score: 3, Informative

    The article seems to be rather narrowly from a computer hobbyists' point of view.

    It fails to point out that compile times are a fairly critical factor in programmer productivity. Yes, we should care that compile times with the Intel compilers look to be over 25% shorter than with gcc on average. (very rough eyeball estimate)

    I am amused, also, at how perplexed the author seems that IBM would ship Eclipse 2.x (and CDT 1.x, its associated C/C++ plugins) with the compiler. The CDT plug-ins for Eclipse 3.x were only ready a couple of months ago, so this is plainly a matter of how much time and money the Intel team had to test them with ICC. Or maybe they weren't available yet at all: when WAS the Intel 8.1 compiler released, anyway?

  20. Re:Believe this? by ChaoticCoyote · · Score: 2

    Ah! A typo! I cut-and-pasted the OS test, and forgot to change "AMD64" to "x86" for the Pentium 4. I just made the trivial edit.

  21. Re:ProPolice by DrSkwid · · Score: 4, Interesting

    The OpenBSD team use it, and I think they know better than you or I.

    Not by technical choice, they want to use plan9's C compiler but have licence quibbles.

    Quoting Theo : "in particular we were interested in the c compiler"

    --
    There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
  22. C/C++ vs. Fortran by Aardpig · · Score: 4, Interesting

    I find it interesting that there are only two C/C++ compilers available for Linux, as compared with seven Fortran 90/95 compilers (soon to be eight with the release of GCC 4.0). This not only dispels the myth that Fortran is a dead language, it also suggests that there is much more of a competitive market in compiling numerical code, than in producing other types of software.

    --
    Tubal-Cain smokes the white owl.
    1. Re:C/C++ vs. Fortran by ChaoticCoyote · · Score: 2, Interesting

      I'm working on a Fortran 95 comparison, which will include several products.

      Most people doing serious numerical work are creating proprietary or in-house applications; few people have the clusters required to run the type of code written in Fortran. So there is a commercial market for Fortran; places like National Laboratories and universities have the money to buy software.

    2. Re:C/C++ vs. Fortran by Too+Much+Noise · · Score: 4, Informative

      Who said there are only 2 compilers? He only tested 2, that's all. Here's a bit of a list - and notice that some of these are targeted specifically to scientific computing:

      1. GCC
      2. Intel compiler (Intel only)
      3. Comeau
      4. PathScale (Opteron only)
      5. Portland Group (PGI)
      6. Borland

    3. Re:C/C++ vs. Fortran by Brandybuck · · Score: 2, Interesting

      the reason for the dearth of C++ compilers is because C++ is an ugly language that is nearly impossible to implement correctly.

      I would rephrase that to say that C++ is a *big* language with a spec managed by committee.

      --
      Don't blame me, I didn't vote for either of them!
  23. Mixing versions of Intel-compiled code is problem by Anonymous Coward · · Score: 2, Informative

    One thing that the article doesn't focus on, but is also an issue for developers is the effect of actually using the compilers in a realistic development environment, where you have to integrate code from several vendors.

    I write code for a large enterprise software company, and was investigating using the Intel compiler. More specifically, I needed to use Xerces, Xalan, and ICU, and Xerces and Xalan come with pre-compiled binaries that are compiled using the Intel compiler.

    I started investigating, and one of the major hurdles I ran into was that Intel's CRT, libcxa.so has issues when linking several shared libraries that themselves individually link to different versions of libcxa.so.

    For example, DB2's client libraries are evidently compiled using Intel's C++ compiler, but our DB2 client libraries were using a relatively old version, I think version 3. The Xerces libs were compiled using an newer version of Intel's compiler, I think version 5 or 6. When I tried to link my entire binary, I ran into run-time issues where the expected libcxa.so's conflicted.

    We ended up ditching the entire thing and compiled Xerces and Xalan ourselves using gcc.

    The other issue, of course, is what is our rights to distribute libcxa.so? I figured the entire thing wasn't worth it.

    However, the Intel compiler did generate much better warnings and errors and in general felt much more polished. It wasn't for us, but it's something that should definitely be investigated if you want something that is commercially supported.

  24. Re:Not a lot of selection for Linux compilers, eh? by Jollyeugene · · Score: 5, Interesting
    Other compilers for Linux (Try google before you troll):

    TCC (tiny c compiler).
    Compaq Alpha C compiler.
    OpenWatcom C/C++ compiler
    TenDra C/C++ compiler
    egcs compiler (which merged into gcc- they saw that it had some advantages.)
    ChEmbeddable
    Cint c/c++ interpreter (not exactly a compiler)
    CC65 Commodore C compiler
    Absoft C/C++ Fortran compiler
    lcc

    These all run on linux. Some are open, some are not. GCC is used mainly because it is portable to just about anything-- so there goes your argument of GCC restricting choice. GCC exists to promote choice, and it does this.

    Take your code written for Visual Studio and compile it on Sun. Can't do that with Visual Studio? No MFC on Sun? Your best bet will probably be good old GCC with WINE. So how are you restricted by gcc?

    Now, if you want to make a cross compiler to compete with gcc- one with seperate front ends and back ends, so it can accept multiple languages, and can compile to just about every machine on earth-- then nothing is stopping you. Oh, what is that? Not interested. Neither is anyone else. Programers see no need to duplicate something that has been done well the first time. One good cross compiler is enough- GCC represents a NATURAL MONOPOLY.

  25. The even-odd thing... by devphil · · Score: 4, Informative


    ...does not apply to GCC. Never has. And it will not in the future, unless we radically change the way we do development and releases.

    3.4 follows 3.3 follows 3.2, and none of them were singled out as "developmental" or "experimentalal" or "extra stable". The experimental-vs-stable changes all take place before any release branch is made. There's more info on the website if you want.

    --
    You cannot apply a technological solution to a sociological problem. (Edwards' Law)
  26. gcc 3.4 still a little unreliable by kanly · · Score: 3, Informative

    I've been developing in C++ with gcc 3.3 for some time, and just moved to 3.4 for some testing. Thank god for unit tests. There's some bitop-heavy code that gets miscompiled with full optimization (-O2). In the process of trying to debug these (I'm not prepared to assume that they're the compiler's fault, it could certainly be my code invoking implementation-defined behavior,) I managed to get the compiler to choke with the -fschedule-insns flag with 'no free register' errors.

    In short, I don't have much confidence in the optimizer in 3.4. I'm trying to condense the problem to a testcase right now to submit a bug report.

    1. Re:gcc 3.4 still a little unreliable by kanly · · Score: 3, Informative

      If you're not prepared to assume it's a compiler problem, then why do say your code "gets miscompiled"? That sure reads like an accusation, which you acknowledge as being unfounded in the next sentence.

      OK, let's try this again. I'll type more slowly, so you can understand.

      The code is fairly complicated. It passes unit tests under 3.3 regardless of options. Under 3.4 without optimization it works fine, but when I use -O2 it behaves differently. Either my code is broken in a subtle way that only manifests under 3.4 with optimization, or the 3.4 optimizer is doing something naughty. I don't know which yet. Either way, I'm warning people that the 3.4 optimizer may treat code differently than 3.3 did. That's not an accusation.

      In the process of trying out different compile options to see if I could get a better idea of what was going on, I managed to get the compiler to bomb out completely and fail to generate any executable at all, with errors that appeared to be the optimizer finding itself unable to find enough registers. IMHO, that justifies some suspicion about the compiler's code generation.

  27. Interesting image. by arose · · Score: 2, Funny

    Both Coke and Pepsi. What's the benchmark on those?

    --
    Analogies don't equal equalities, they are merely somewhat analogous.
    1. Re:Interesting image. by ChaoticCoyote · · Score: 3, Funny

      Coke goes better with rum.

      Well, that's my opinion. My wife insists that Diet Pepsi (ugh!) is a better mixer, but then, her sanity is in question given that she married me.

    2. Re:Interesting image. by Anonymous Coward · · Score: 2, Funny

      Cheesy passive-agressive self deprecation comedy mixed with a "slip it to 'em that I probably had sex at least once" tangent? Thank god I didn't read your article.

    3. Re:Interesting image. by Anonymous Coward · · Score: 2, Funny

      No time to read the article, but time to troll through endless /. posts looking for sexual innuedo? Yes, *I* read all the posts as well, but I'm not being dishonest...

    4. Re:Interesting image. by ChaoticCoyote · · Score: 2, Insightful
      Cheesy passive-agressive self deprecation comedy mixed with a "slip it to 'em that I probably had sex at least once" tangent? Thank god I didn't read your article.

      Sounds like jealousy to me... ;)

  28. Are these tests even a valid measure? by skids · · Score: 2, Insightful

    Seems to me, you don't test the speed of a compiler on number crunching programs -- they are likely to have hand optimizations in them, and can benefit from hand optimization a lot more, so the compiler isn't as important in these applications since if you want real speed you write a core in asm.

    He should have tested code that contains a lot of tangled up complex loops switches and jumps. Like libperlre's parsing and execution speeds. That and some really horribly over-abstracted C++ code where 15 classes are used just to add two numbers together.

    (Perhaps the best test would be to compile a second copy of one version of gcc, and see how fast that can compile itself afterwards.)

  29. If you must have optimized support for AMD... by Ayanami+Rei · · Score: 2, Interesting

    Portland Compiler Group has a compiler that's fairly decent and optimizes for both AMD64 and Intel 32-bit (although they're pushing the AMD64/clustering angle right now).

    It's nice, but much less free. 15-day free trial. Prices are not bad, but it's still a little steep, even for an academic license.

    This is not a plug... just in case anyone was wondering if there was something besides ICC you could try in to benchmark GCC on something that ICC can't cope with.

    --
    THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
  30. LLVM and C++ by pb · · Score: 3, Interesting

    Another thing to try--LLVM can use g++ as a front-end to compile C++, and can often do further optimizations to speed things up even more. LLVM also has a C back-end, so you can benchmark other C compilers against each other too!

    Of course, the real fun will begin when it has completed Java and C# front-ends. :)

    --
    pb Reply or e-mail; don't vaguely moderate.
  31. GCC usually whips ICC for me by Baudelaire76 · · Score: 3, Interesting

    I'm always perplexed by such comparisons. Specifically, everyone talks about how awesome ICC is for numerical stuff. Well, I have written a fair amount of C++ code for computational fluid dynamics, and, for my code, GCC has always beaten ICC by a fairly wide margin (typically, 50 percent or more). Perhaps it has something to do with the fact that my code makes heavy use of templates? I don't really know.

    Also, in my experience, the C++ standard library that shipped with the previous versions of ICC just wasn't that good. Well, that may be a little harsh, but it was a source of considerable irritation to me that ICC's implementation of valarray did not even use expression templates (hello temporaries!). Yes, I know valarray isn't all that, but it is standard C++ (hence, in principle, code that uses it is portable). Once again, the GCC implementation was very much superior. This may be part of the reason why ICC now uses GCC headers.

    (As an aside, I did roll my own implementation of valarray that uses expression templates. I tested it with both GCC and ICC, and GCC still won.)

    I am now curious to test whether things are indeed better with ICC 8.1 (the last version I tested was 8.0). Maybe this time it will actually speed my code up rather than slow it down.

  32. Re:I don't get it... that you don't get it... by Jameth · · Score: 3, Informative

    Or, more specifically, you didn't think to check the facts of the parent post before assuming the author of the article was either stupid or horribly incorrect.

    If you had actually read the article, you would have seen:

    Corwin (Homebrew)
    Gentoo AMD64 GNU/Linux, kernel 2.6 SMP
    Dual Opteron 240, Tyan K8W 2885
    120GB Maxtor 7200 RPM ATA-133 HD
    2GB PC2700 DRAM
    Radeon 9200 Pro, 128MB, HP f1903 DFP

    Tycho (Homebrew)
    Dual Boot: Windows XP Professional
    Gentoo x86 GNU/Linux, kernel 2.6 SMP
    2.8GHz Pentium 4 w/HT, Intel D850EMV2, 533MHz FSB
    2x80GB Maxtor D740X 7200 RPM ATA-100 HD
    512MB PC800 RDRAM
    Radeon 9200 Pro, 128MB, NEC FE990

  33. Re:illogical hostility? by JoeBuck · · Score: 5, Informative

    The complainers can't read. I'm a member of the GCC steering committee, and I'm very happy with Scott's work (sorry, dude, I'm not going to call you "ChaoticCoyote"). It's not perfect, but it has helped to improve GCC.

  34. A few editorial notes. by jbn-o · · Score: 3, Informative

    Quoting the article:

    GCC is, of course, released under the GNU Public License, and I own a commercial license for the Intel compiler.

    Actually, the name of the license is the GNU General Public License. It is "General" because when the GNU project began there was no single license used throughout the project; .

    [...] while GCC has not quite reached the performance of its commercial competitor [...]

    GCC can be commercial too -- many firms distribute copies of GCC for a fee. I believe the author should have said "proprietary" meaning that what the Intel compiler program does, exactly, is secret. As RMS said when describing a proprietary web video streaming application he didn't want MIT to use to distribute a feed of his talk on copyright and globalization:

    "What it does is secret. You can't study it; you can't change it; and you certainly can't publish it in your own modified version. And those are among the freedoms that are essential in the definition of "free software."

    GCC, by contrast, is free software licensed under the GNU General Public License. Getting back to the article:

    These "coyote" benchmarks provide an excellent example of the advantages of "open" software development.

    Here I don't think "open" was the best choice of words, I think "free" would have been more accurate. The GNU Compiler Collection was originally the GNU C Compiler and first written by RMS. I guarantee you that RMS did not and does not now do work for the open source movement. He makes effort to make that point clear (like when he corrected Mike Uretsky who made the same mistake). The FSF asks you not to lump their work in with the work of the open source movement. Eben Moglen spoke at Harvard some months ago and also made this distinction. Prof. Moglen makes it clear why they are so adamant on this point:

    "We need to keep reminding people that what's at stake here is free speech. We need to keep reminding people that what we're doing is trying to keep the freedom of ideas in the 21st century, in a world where there are guys with little paste-it labels with price tags on it who would stick it on every idea on earth if it would make value for the shareholders. And what we have to do is to continue to reinforce the recognition that free speech in a technological society means technological free speech. I think we can do that. I think that's a deliverable message."

    I don't think he's overstating the case.

    Finally, there's a common misunderstood myth repeated in the end of the article:

    "Choice" is the key word here -- choice is good, be it in democracy or software. Intel provides a useful alternative to GCC for development on ia32 systems. One compiler might have a great environment for developing GUI code; another compiler might generate fast code. GPL-like freedom may be important -- or not -- as individual circumstances dictate.

    Many people believe this, I've even heard a variant of this myth being repeated by a representative of the Mozilla Foundation. Choice is no substitute for software freedom, in fact they speak to different aims entirely and in computer software choice is not as important as software freedom. If all we have are three web browsers to choose from (say, Microsoft Internet Explorer, Netscape, and Opera) choice is satisfied. B

    1. Re:A few editorial notes. by ChaoticCoyote · · Score: 2, Informative
      Choice is no substitute for software freedom, in fact they speak to different aims entirely and in computer software choice is not as important as software freedom.

      You can not have freedom without choice. Competition in a diverse environment is the engine of evolution; any monoculture stagnates. I no more want a world run by RMS than I do a society that is beholding to Mr. Gates. A pox on both their monopolistic houses.

      I believe in the competition of ideas, and strongly support and defend the concept of intellectual freedom. I've debated these issues with RMS directly, so I've been through this war before. Much as I respect his ideals, his implementation is lacking and his approach dogmatic and absolutist. Freedom involves the right to disagree with RMS and his acolytes.

      Many argue that we cannot have democracy if we focus on choice: two dominant US political parties have and will cooperate and pursue the same ends (through scheduling exclusionary debates, supporting bills the public doesn't agree with, raising ballot-access levels, making elections prohibitively expensive, etc.)

      The current U.S. political system does not offer significant choice, which is precisely why we need diversity. The difference between Demicans and Republocrats is so small as to be meaningless; trading Kerry for Bush is nothing more than changing dance partners while the same tune plays.

  35. Compatibility issues by captaineo · · Score: 2, Interesting

    Regardless of benchmarks, I consider the nasty backwards compatibility issues of GCC a serious problem. Virtually all of my Linux tech support time over the last two years has been spent messing with libstdc++ or libgcc_s versions to get various software packages to run. The problem is exacerbated because these libraries in turn are coupled tightly to glibc and pthreads, leading to more versioning headaches. My #1 wish for GCC is to get these libraries set in stone and make them as independent of glibc/pthread versioning as possible. I really want to be able to install a random C++ binary and have it work the first time.

    Also, the ability to compile a C++ DSO without requiring the exact same compiler version as the program that will load it, is a major need for commercial Linux software vendors.

  36. Silly gcc optimizations by 0x0d0a · · Score: 3, Interesting

    I was empirically analyzing the gcc 3.3.3 optimizer a couple of days ago. Some interesting points:

    [argh...lameness filter refuses to allow source code]

    I'm providing a link to my journal entry so that I can post these examples.

  37. What about documentation to write new front ends? by master_p · · Score: 2, Interesting

    I am especially interested in GCC because I want to write a new front end (my own programming language). I don't want to mess with back ends, since I am not interested in that stuff; the linguistic part of the programming languages is far more interesting. But I can't find decent documentation anywhere on the internet for a GCC newbie. I tried looking at the source code, but it is an ugly mess of macros. The article of course mentions C/C++ only, but GCC is something more than that...I think it deserves a well written piece of how to extend it with new front ends.

  38. Compile time by Per+Abrahamsen · · Score: 2, Interesting

    I always get confused about people claiming compile time is important for development. It seems to be people who make a habbit of compiling everything from scratch. Haven't they heard of make? To me, link time is the limiting factor. When I make a change, I have to compile just the file I changed, or maybe a handfull of files if I changed an interface. And then I have to link all 236 files, which is where the time is spend.

    I can see it compile time being important to people who use the compiler as an install tool (like gentoo users), but not for any serious developers.

  39. compiling linux with a different compiler? by polyp2000 · · Score: 2, Interesting

    Does anyone know if it is possible to use one of the alternative compilers ICC , OpenWatcom or Corneau ? to build a linux system from scratch?

    I would be truely intrigued at what overall performance might be like.

    --
    Electronic Music Made Using Linux http://soundcloud.com/polyp
  40. 1983 called.... by tundog · · Score: 3, Funny


    1983 called and it wants its programming language back.....

    --
    All your base are belong to us!
  41. Re:Not a lot of selection for Linux compilers, eh? by antime · · Score: 2, Informative

    Nowadays LCC-Win32 is a very different compiler from LCC. Jacob Navia bought a license for LCC3.6 (IIRC) and has developed it independently since then. His version has lots of features (eg. optimizers, C99) not in Fraser's and Hanson's LCC. And then there's the whole win32 thing too.. (There is also a "rival" LCC for Windows written by a Swede, called Pelles C.)

  42. Re:What about documentation to write new front end by Haeleth · · Score: 2, Informative

    Obscure names like 'yylex()' and stuff don't really help.

    And I don't need lessons on yacc and bison.


    I think you probably do need lessons on yacc and bison, if you think "yylex()" is an obscure name. It's the totally standard name for the lexer callback used in yacc and most of its clones. And the relevant section of the Bison manual is the third hit when you google for it -- so much for "no decent documentation"!

    Methinks you could have chosen a better example...

  43. Re:What about documentation to write new front end by ctid · · Score: 2, Insightful

    If you don't want to mess with back-ends etc, why not get your program to spit out C code? Then compile that with gcc. I think that SmallEiffel started out this way.

    --
    Reality is defined by the maddest person in the room