Slashdot Mirror


Reduce C/C++ Compile Time With distcc

An anonymous reader writes "Some people prefer the convenience of pre-compiled binaries in the form of RPMs or other such installer methods. But this can be a false economy, especially with programs that are used frequently: precompiled binaries will never run as quickly as those compiled with the right optimizations for your own machine. If you use a distributed compiler, you get the best of both worlds: fast compile and faster apps. This article shows you the benifits of using distcc, a distributed C compiler based on gcc, that gives you significant productivity gains."

16 of 292 comments (clear)

  1. Slashdot/OSNews Merger? by illuminata · · Score: 0, Insightful

    Well, they might as well merge sites if they're going to share stories.

    --


    Until Slashdot fixes the funny modifier, use insightful or interesting. The poster knows your intentions.
  2. Productivity Gains My Arse by Anonymous Coward · · Score: 2, Insightful

    Any application I have to compile before using with the 'correct optimizations for my machine' will take more time to get up and running than any 'productivity gains' it might produce. This is why Linux is still not accepted by mainstream computer users. They don't care how it works, just that it does.

  3. false savings by Yojimbo-San · · Score: 5, Insightful

    Compare the speed cost of loading a "generic" binary to an "optimised" one, multiply by the number of times you load that binary.

    Then look at the time required to compile the optimised copy.

    How often, in the lifetime of a particular version of a binary, do you really need to reload it?

    The promise of distcc is closely related to source distributions like Gentoo. The benefit is overstated. Don't waste your time.

    --
    Quick wafting zephyrs vex bold Jim
    1. Re:false savings by boots@work · · Score: 2, Insightful

      Insightful, or Troll? The eternal question....

      The promise of distcc is closely related to source distributions like Gentoo. The benefit is overstated.

      The promise has nothing to do with Gentoo. distcc was released before Gentoo was well-known, and is useful to people who never run Gentoo.

      You see, some of us actually develop our own software, rather than building distributions from source. If you write your own code in C or C++, you need to compile it, probably many times per day. If you work on large projects, getting builds done in seconds rather than minutes can make the whole development process more pleasant.

  4. Yes, it doesn't work with everything... by cbreaker · · Score: 2, Insightful

    Which makes it a pain in the ass if you ask me.

    I have tried to use distcc for a lot of stuff, but it doesn't work on some packages, and that's enough to make me not use it.

    I don't want to have to hand-pick which packages to use it with and which ones to not use it with. Fortunately, a lot of Gentoo packages have a rule built in to not use distcc automatically, but it's not always the case.

    The other thing about distcc is that it won't increase the speed of the compile by any large magnitude with each machine added because the machine performing the actual compile has to do a lot more work then the slaves.

    Unless I was trying to compile something on a REALLY slow machine, I don't bother with distcc.

    --
    - It's not the Macs I hate. It's Digg users. -
  5. Right, whatever by Anonymous Coward · · Score: 3, Insightful

    Precompiled binaries will never run as quickly as those compiled with the right optimizations for your own machine

    And there are maybe about ten to fifteen people on all of slashdot who actually know how to go about setting the right optimizations for their own machine.

  6. Re:Less and less necessary in the future by ThisNukes4u · · Score: 5, Insightful

    There are still enterprise uses where coders need to compile huge projects from scratch that take too long on a single workstation. Instead of that build taking 15 minutes on a single workstation, they can tap the power of all the workstations and build it in a few minutes or perhaps even seconds.

    --
    thisnukes4u.net
  7. Productivity gains if and only if.... by Kjella · · Score: 3, Insightful

    "(...) a distributed C compiler based on gcc, that gives you significant productivity gains."

    Assuming
    a) That compiling will give you any significant performance increase (which I kinda doubt, it's not like the defaults are braindead either)
    b) You don't spend more time mucking about with distCC / compiling than you'll actually use the software
    c) Your software is actually code bound (and not "What do I type/click now?" human bound, or bandwidth bound or whatever)

    I can't think of a single thing I do that's code bound. And I actually do a bit of compiling, but I spend those seconds thinking about what to code next. Either that, or it is bandwidth bound or non-time critical (i.e. does it take 6,5 hours or 7 hours? Who cares. The difference is half an hours work for my computer, 0 for me. So the time I'd spend to improve it is - gasp - 0.

    Kjella

    --
    Live today, because you never know what tomorrow brings
  8. Re:I have only one computer by EvilTwinSkippy · · Score: 2, Insightful
    You would only see a performance improvement if the participants in a distcc cluster are all on the same LAN. Unless you have a really slow computer, the time it takes to upload the code and download the results over a broadband connection exceeds the time savings in shipping the job out.

    In my home environment, I have my slow lil' K6 400 ship it's compile jobs to my Athlon XP with 512MB of RAM. Both are on the same local network. In a home environment, if you have a brawny box and a scrawny box, DISTCC is your best friend. (Assuming you have to do a pile of compiles.)

    Another approach is to simply compile all your stuff on a powerful box, and copy the binaries to the scrawny ones.

    --
    "Learning is not compulsory... neither is survival."
    --Dr.W.Edwards Deming
  9. It's news to some people by cbreaker · · Score: 4, Insightful

    It's news to people that don't read slashdot every day.

    I don't mind revisiting older topics once in awhile - it's only annoying when it's two days in a row. And even then, it's not that big of a deal, I simply pass over it.

    Posts like this are more waste of space then then a duplicate article post, and you get a lot more posts like yours then we do dupes. It's especially annoying when people say "We talked about this TWO YEARS AGO!!!" Well here's some news for you: I don't memorize every slashdot story since the beginning, and there's been a lot of new members since then.

    --
    - It's not the Macs I hate. It's Digg users. -
  10. Compiling Gentoo for speed.... with gcc? by scheveningen · · Score: 2, Insightful

    Honest question: gcc has the reputation of not producing the fastest code for x86, so why should I bother compiling gentoo with gcc or distcc?
    Does anyone know if there are distro's compiled with, say, the Intel compiler?

  11. Wait a sec by EvilStein · · Score: 2, Insightful

    The Anti-Gentoo zealots always say stuff like "It's not going to be faster.." etc etc..

    Now someone is saying: "precompiled binaries will never run as quickly as those compiled with the right optimizations for your own machine."

    So, the Gentoo users that are claiming that stuff compiled with the right optimizations *is* faster?

    I'm confused. Which is it supposed to be? Are Gentoo users full of crap, or are they correct?

    I use Gentoo and have found things to be a hell of a lot easier to deal with than RPM based binary distros anyway.
    I just want the scoop. :P

    Oh, distcc has been in Gentoo for a while.. surprised to see it listed like it's a new thing.

    1. Re:Wait a sec by cas2000 · · Score: 3, Insightful

      > I'm confused. Which is it supposed to be? Are
      > Gentoo users full of crap, or are they correct?

      for almost all programs, it's not going to be *noticably* any faster. on average, you can get maybe 1% to 5% performance improvement from CPU-optimised binaries. this generally isn't worth the time and effort it takes to do the custom compile.

      for heavy graphics processing or number crunching, you'll probably notice that. you almost certainly wouldn't notice it on anything else.

      so, yes, the gentoo users are full of crap....the same kind of crap that obsessive overclockers are full of when they get so self-impressed by the 1% extra performance that they get out of their combination CPU/egg-frier.

  12. Obligatory "No" by timotten · · Score: 5, Insightful

    precompiled binaries will never run as quickly as those compiled with the right optimizations for your own machine

    A straw man. Precompiled binaries may have been compiled with the optimal settings for your machine, and binaries which you compile may not have the optimal settings. Identifying the optimal settings can actually be non-trivial. Source-based distributions are not necessarily the best fix to the 'one-size-fits-all' approach used by some distro's.

  13. Re:No, no, no! by evilviper · · Score: 3, Insightful
    Try using a compiler that compiles fast -- such as Plan 9s compilers.

    Well, that won't help anyone, since almost nobody runs Plan 9.

    Also, advising people to use faster compilers is bad advice. The point is to make the application faster, and the slower the compile, the faster the application is likely to run. eg. GCC2 vs GCC3

    Reducing compile time by distributing the load isn't reducing it all

    Yes, you are reducing the time it takes to complete the process. It doesn't reduce CPU-time, it reduces real-time. You know, the real world, in which we live... The only thing that really matters.
    --
    Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
  14. Re:No, no, no! by evilviper · · Score: 3, Insightful
    I'd take a quick compile over fast execution of code in most situations.

    I wouldn't. I compile my programs once, then use them for MONTHS on end. Even a tiny speed improvement in something like Mozilla will save a HUGE ammount of time overall, and by far make up for the compile time.

    When I am programming, I'll disable ops so I can test my changes quicker, but that's not what we are talking about here...
    --
    Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant