Slashdot Mirror


Java Faster Than C++?

jg21 writes "The Java platform has a stigma of being a poor performer, but these new performance benchmark tests suggest otherwise. CS major Keith Lea took time out from his studies at student at Rensselaer Polytechnic Institute in upstate New York's Tech Valley to take the benchmark code for C++ and Java from Doug Bagley's now outdated (Fall 2001) "Great Computer Language Shootout" and run the tests himself. His conclusions include 'no one should ever run the client JVM when given the choice,' and 'Java is significantly faster than optimized C++ in many cases.' Very enterprising performance benchmarking work. Lea is planning next on updating the benchmarks with VC++ compiler on Windows, with JDK 1.5 beta, and might also test with Intel C++ Compiler. This is all great - the more people who know about present-day Java performance, the better.""

7 of 1,270 comments (clear)

  1. Java may be fast but ... by Anonymous Coward · · Score: 0, Troll

    ... C++ is more portable.

  2. Developers: World Flat, Sky Green by random+coward · · Score: 0, Troll

    And Microsoft is more stable than Linux.

  3. Nort really surprising by Anonymous Coward · · Score: 0, Troll

    Just see what comes out of profiling this:

    int main( int argc, char **argv )
    {
    for ( int ii = 0; ii < 10240; ii++ {
    cout << ii << endl;
    }
    return( 0 );
    }

    Now compare it to this:

    int main( int argc, char **argv )
    {
    char s[ 2 ];
    s[ 1 ] = '\n';
    for ( int ii = 0; ii < 10240; ii++ {
    s[ 0 ] = '0' + ( char ) ii;
    write( 1, s, 2 );
    }
    return( 0 );
    }

    Guess which one's going to be several orders of magnitude faster?

  4. Java is still pants... by Skiron · · Score: 0, Troll

    ... and always will be.

    Give me ONE good reason what java actually does right?

    You need one hell of a machine to run all the crap. It is still not fault tolerant to any degree.

    And seeing as it was initialy designed to run video recorders and washing machines, et al, why doesn't it now?

    Nick

  5. I don't know about Java, but... by callipygian-showsyst · · Score: 1, Troll
    I refuse to run Java for political reasons (I don't care to support pedophilia), but I recently starting doing a lot of work in Microsoft's C#, which is similar in it's implementation.

    Like Java, C# is compiled to an intermediate code for a "virtual machine" that is typically JIT compiled for the target processor. I've been amazed at the speed. I'm doing graphics applications where I'm moving bits around manually, and C# is plenty fast! And it's nice to have garbage collection and modern features.

    C# also has some other advantages over Java: it's a standard language (it has been submitted to the ECMA standardization committee), and has advanced features like "generic types" (similar to templates), pointers, and good XML serialization support.

  6. Ah, C++ ... by Crispin+Cowan · · Score: 0, Troll
    C++ has the safety of C, and the performance of SmallTalk :(

    There is no excuse for writing anything in C++ in this day and age:

    • If you are writing a kernel or an embedded bit whacker or a real-time thing, use C. C++ is too slow.
    • If you are writing an application, be it desktop, server, whatever, use Java or C#. C++ is far too unsafe.
    • If you are writing a rapid prototype, use PERL, or Python, or Ruby.
    My condolances to the KDE kommunity. It's a cool desktop & all (I'm typing on it) but bolting your whole framework on a C++ basis was a really unfortunate choice. It dooms KDE to long-term security vulnerabilities.

    Crispin
    ----
    Crispin Cowan, Ph.D.
    CTO, Immunix Inc.

  7. *sigh* by ldspartan · · Score: 1, Troll

    So, I'm done with my CS degree from RPI, and I'd like to point out we're not all morons like this kid apparently is. Also remember he's just finished his sophomore year, and has probably just taken basic classes like Data Structures and Algorithms and Operating Systems.

    It just cheapens my degree, sadly.

    --
    lds