Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: "Java is slow" myth

  1. #1
    Junior Member
    Join Date
    Jul 2014
    Posts
    10
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default "Java is slow" myth

    So hello guys, i hear quite often those three words: Java is slow? So can someone explain me what does it means. Like it will never be fast like C/C++ etc. I don't understand that.

    Thanks in advance!!!


  2. #2
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,707
    Thanks
    25
    Thanked 338 Times in 313 Posts

    Default Re: "Java is slow" myth

    It is an old myth that is no longer true. It was true back in 2000, but isn't true anymore. Modern Java runs as fast as any other language. The "slow" myth was largely a criticism of the old pre-2000 virtual machine vs natively ran code.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  3. The Following 2 Users Say Thank You to aussiemcgr For This Useful Post:

    GregBrannon (August 18th, 2014), HypeIsReal (August 18th, 2014)

  4. #3
    Senior Member
    Join Date
    Jul 2013
    Location
    Europe
    Posts
    900
    Thanks
    0
    Thanked 166 Times in 148 Posts

    Default Re: "Java is slow" myth

    aussiemcgr is right.
    Back in the days java was rather slow because its byte code needed to be interpreted to be run. Today, black voodoo magic (the JIT) happens in the background to compile the java byte code to native code on the run. This can be exactly as fast as C or C++ code can be if we assume that the JIT does good work.
    However, the JIT needs some time to heat up. So in the beginning java programs tend to be a little bit slow if you start them the first time. But once everything is cached and compiled things will go as fast as possible.

  5. The Following 2 Users Say Thank You to Cornix For This Useful Post:

    GregBrannon (August 18th, 2014), HypeIsReal (August 18th, 2014)

  6. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,607
    My Mood
    Hungover
    Thanks
    145
    Thanked 658 Times in 563 Posts

    Default Re: "Java is slow" myth

    First of all, saying "Java is slow" is a bit too vague to mean anything. Slow when? On what system? Which part of it is slow?

    That being said, saying "Java is slow" is simply not true. It got a bad reputation in the 1990s due to requiring the JVM and thanks to novice programmers who didn't understand how to use the EDT, resulting in unresponsive GUI programs- but that was the fault of the programmers, not Java.

    Since then, Java has made several advancements, including the just-in-time compiler, that put many benchmarks on par (or even better than) other languages. Java has also expanded to include JavaEE (which powers many of the websites that you use every day), as well as Android.

    The one place Java can't go (and this is by design) is native code. So if you're writing code for a particular piece of hardware, then you'll have to use a lower-level language. But you can use JNI to call that native code from Java.

    That being said, one of the most important benchmarks is *programmer time*. Instead of thinking about how fast your code will go (which, like I said above, is probably fine), think about how long it will take you to accomplish a particular task. How fast can you get a window with some buttons up and running in C++? In Java, that would take about a minute. How fast can you set a server up? An Android app? In that way, Java is one of the fastest languages around. Also, what if you have to maintain some code written by somebody else? Would you rather that code be in C++, or in Java?

    Recommended reading:
    http://en.wikipedia.org/wiki/Compari...va_and_C%2B%2B
    http://stackoverflow.com/questions/1...ance-vs-java-c
    http://en.wikipedia.org/wiki/Java_performance
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  7. The Following 2 Users Say Thank You to KevinWorkman For This Useful Post:

    GregBrannon (August 18th, 2014), HypeIsReal (August 18th, 2014)

  8. #5
    Junior Member
    Join Date
    Jul 2014
    Posts
    10
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: "Java is slow" myth

    Guys, thanks for responses. That all makes sense. Thanks to all of you!!!
    Cheers!

Similar Threads

  1. Replies: 6
    Last Post: August 16th, 2014, 02:34 AM
  2. Replies: 2
    Last Post: May 22nd, 2014, 02:17 PM
  3. Replies: 2
    Last Post: June 22nd, 2013, 11:30 AM
  4. Replies: 3
    Last Post: December 7th, 2011, 02:03 AM
  5. Replies: 7
    Last Post: August 13th, 2011, 02:22 AM