Slashdot Mirror


C++ the Clear Winner In Google's Language Performance Tests

Paul Dubuc writes "Google has released a research paper (PDF) that suggests C++ is the best-performing language on the market. It's not for everyone, though. They write, '...it also required the most extensive tuning efforts, many of which were done at a level of sophistication that would not be available to the average programmer.'"

6 of 670 comments (clear)

  1. Common knowledge by PitaBred · · Score: 4, Insightful

    I thought this was common knowledge. Did anyone ever doubt that?

    1. Re:Common knowledge by AuMatar · · Score: 5, Insightful

      There's a lot of Java-ites who claim that Java is just as fast. They're idiots, but they're vocal.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    2. Re:Common knowledge by Unoriginal_Nickname · · Score: 4, Insightful

      Boost/0x shared_ptr can't handle circular references.

      That's why people focus on memory management when they talk about C++: it's filled with 'gotchas' that will completely fuck you up if you don't completely understand everything you are doing. That's why so many C++ 'fans' hate automatic memory management. It's not because they're attached to the idea of manual memory management, it's because C++ forces you into a culture of paranoia and it's difficult to adjust to a world where the standard library isn't out to kill you.

  2. Re:C/C++ faster but produces more bugs by Erbo · · Score: 4, Insightful
    And, while C++ will always necessarily be faster to execute, there's no question that the other three languages will be faster and more straightforward to develop in. (Which, in general, makes them a net win, as programmer time is almost always more expensive than computer time, except in certain corner cases which should be obvious.)

    Why? Three words: Automatic memory management.

    No more worrying about whether you've allocated the right buffer size for your data...and maybe allocated too little resulting in an overrun screw, or allocated too much and wasted the memory. And no more forgetting to free that memory afterwards, resulting in a memory leak. You can write expressions like "f(g(x))" without having to worry about how the return value from "g" is going to be freed, allowing a more "natural" coding style for compound expressions.

    I maintain that automatic memory management, while not great for code-execution performance, is probably the single biggest boon to developer productivity since the full screen-mode text editor. (Not saying "emacs" or "vi" here. Take your pick.)

    Granted: You can retrofit a garbage-collecting memory manager onto C++...but that code will rob your C++ code of some of that enhanced execution performance which is probably the reason why you chose to develop in C++ in the first place.

    --
    Be who you are...and be it in style!
  3. Java is fast by wurp · · Score: 4, Insightful

    In some situations Java will be faster than unoptimized C++ - JIT compilation will do enough of a better job than vanilla C++ to make the difference. In general, C++ will clearly be faster. However, I think what most of the people you're qualifying as idiots get up in arms about (rightly) is the assumption that so many programmers seem to make that Java will be many times slower than C++. That's (usually) just wrong.

    In particular, here's what Google's analysis had to say about it on page 9:

    Jeremy Manson brought the performance of Java on par with the original C++ implementation

    They go further to say that they deliberately chose not to optimize the Java further, but several of the other C++ optimizations would have applied to Java.

    For most programming tasks, use the language that produces testable, maintainable code, and which is a good fit for the kind of problem you're solving. If it performs badly (unlikely on modern machines), profile it and optimize the critical sections. If you have to, write the most critical sections in C or assembly.

    If you're choosing the language to write your app based on how it performs, you are likely the one making bad technical decisions.

    1. Re:Java is fast by Splab · · Score: 4, Insightful

      For me it doesn't matter which language is faster, I'm using the one that solves my problem the fastest (e.g. shippable product fastest) and right now, Java is the main player for me.

      Also, since our CPUs aren't getting any faster, we need to use languages that makes threading easier the safest way and on that topic, Java is miles ahead of C++. (Java used to have an utterly broken threading model, but these days it works [tm]).