Is Java Really THAT Slow?

  • (2 Pages)
  • +
  • 1
  • 2

17 Replies - 6742 Views - Last Post: 10 February 2011 - 07:06 PM

#1 Mokgar   User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 113
  • Joined: 21-December 10

Is Java Really THAT Slow?

Post icon  Posted 05 February 2011 - 02:09 PM

I spent ages searching the app store for a simple program that would let me write java on my ipod and it would have syntax highlighting and it would let me save it to a file that I could then move over to my computer and carry on with it on my computer then move it back onto ipod ect. I searched but with no avail, so I thought maybe this could be a project for me that I could work on and add to as I progress on my java journey, so I set out to find out how I could go about this with java and imagine the sheer disappointment I felt when I ran into this: "Java's not worth building in. Nobody uses Java anymore. It's this big heavyweight ball and chain." - Steve Jobs
Now, I knew java was slower than the like of C++, but that's just harsh and people certainly use it, in fact I was under the impression that it was fairly widely used, and as it gets more powerful it's usage was growing? I may be wrong but that's the impression I was under.
Do you really think that java is that bad of a language? Personally I love java, it's useful has good usability and I don't find it as slow and inefficient as people make it out to be... although I haven't made anything big or complicated yet.

Is This A Good Question/Topic? 4
  • +

Replies To: Is Java Really THAT Slow?

#2 Dogstopper   User is offline

  • The Ninjaducky
  • member icon

Reputation: 2965
  • View blog
  • Posts: 11,222
  • Joined: 15-July 08

Re: Is Java Really THAT Slow?

Posted 05 February 2011 - 02:35 PM

I renamed your title to better describe the topic. Steve Jobs couldn't have been more wrong. Java is one of the most popular languages today and it's cross-platform nature aloows it to be ported to nearly everything, including mobile devices.

As for the whole Java is slow myth - it's totally wrong. Of course it's easy to write bad code, but you can do it in C. In some benchmarks, Java performs BETTER than native C:
http://scribblethink...Cbenchmark.html

The VM is rather large, and I'll give Jobs that point, but Google managed to make it very usable for small devices like the Android. Thus, the optimizations can be made...
Was This Post Helpful? 1
  • +
  • -

#3 Mokgar   User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 113
  • Joined: 21-December 10

Re: Is Java Really THAT Slow?

Posted 05 February 2011 - 02:37 PM

View PostDogstopper, on 05 February 2011 - 02:35 PM, said:

I renamed your title to better describe the topic. Steve Jobs couldn't have been more wrong. Java is one of the most popular languages today and it's cross-platform nature aloows it to be ported to nearly everything, including mobile devices.

As for the whole Java is slow myth - it's totally wrong. Of course it's easy to write bad code, but you can do it in C. In some benchmarks, Java performs BETTER than native C:
http://scribblethink...Cbenchmark.html

The VM is rather large, and I'll give Jobs that point, but Google managed to make it very usable for small devices like the Android. Thus, the optimizations can be made...

Oh I see, yes google have made it work well with android, I don't see why it won't be added to the ipod.
Was This Post Helpful? 0
  • +
  • -

#4 Dogstopper   User is offline

  • The Ninjaducky
  • member icon

Reputation: 2965
  • View blog
  • Posts: 11,222
  • Joined: 15-July 08

Re: Is Java Really THAT Slow?

Posted 05 February 2011 - 02:39 PM

Apple is extremely proprietary. Did you see how they treated flash? I don't think Java will ever be...
Was This Post Helpful? 0
  • +
  • -

#5 calebjonasson   User is offline

  • $bert = new DragonUnicorn(); $bert->rawr();
  • member icon

Reputation: 209
  • View blog
  • Posts: 989
  • Joined: 28-February 09

Re: Is Java Really THAT Slow?

Posted 05 February 2011 - 02:39 PM

Here is a video I watched a while ago, I thought that it would be relevant. Also, Javas lack of speed is becoming less and less of an issue with mobile phones since they are getting faster and faster.

http://www.youtube.c...h?v=It8xPqkKxis
Was This Post Helpful? 0
  • +
  • -

#6 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8379
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: Is Java Really THAT Slow?

Posted 05 February 2011 - 03:13 PM

I work in a shop where we program slot machines in C on a propriatery board.
Many times we have performance issue (refresh rate of the display in less than 1/60 of a second)

Never I was not able to reproduce (at home in Java) the original problem and make it work.
Performance issues with a language depends 10% of the language 90% of the programmer :)
Was This Post Helpful? 2
  • +
  • -

#7 macosxnerd101   User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12390
  • View blog
  • Posts: 45,519
  • Joined: 27-December 08

Re: Is Java Really THAT Slow?

Posted 05 February 2011 - 03:15 PM

Apple is supporting Java via the OpenJDK project, so there is hope for the iPod and iPad platforms.
Was This Post Helpful? 1
  • +
  • -

#8 Sergio Tapia   User is offline

  • D.I.C Lover
  • member icon

Reputation: 1258
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: Is Java Really THAT Slow?

Posted 05 February 2011 - 03:36 PM

Java is considered "slow" because before you had to wait for the VM to start up. This used to be quite slow.

But now? Heh! You'd be hard to pressed to find a regular use case where a low level language like C is faster than Java.

Of course Java has a bad reputation of being slow because it was a pain in the ass from the user standpoint. I remember sometimes launching a Java based application (Limewire) and having to wait for the VM to load. Not cool!

Eventually it got much faster with things like:

The compiler got better at optimizing.
JIT compilation was added in Java 1.1 and improved significantly over the years, which can make Java code run at near native speed.
The libraries were improved and expanded giving you lots of things from the get go.
Garbage collection was vastly improved.

Edit: Why the negative rep?

This post has been edited by Sergio Tapia: 05 February 2011 - 05:01 PM

Was This Post Helpful? 4
  • +
  • -

#9 Martyr2   User is offline

  • Programming Theoretician
  • member icon

Reputation: 5309
  • View blog
  • Posts: 14,172
  • Joined: 18-April 07

Re: Is Java Really THAT Slow?

Posted 05 February 2011 - 04:31 PM

Most of the points have been made here so I just wanted to reiterate...

1) Java was slow but now is pretty much on par with C/C++.
2) Apple is proprietary in a lot of what they do. They want everyone to use objective-C... how to do it? Buy a mac. Get the picture?
3) Java runs on a multitude of different platforms from mainframes to Android and Blackberry devices. It in fact has more of the share of mobile devices than any other language right now. Since Android/Blackberry have the biggest share and they use Java, that means it has the biggest share.
4) Java is extremely popular. Don't believe me? Just check out how many threads we going here on DIC!

Personally I love C# more than Java, but I have to admit that Java has its charms. :)
Was This Post Helpful? 3
  • +
  • -

#10 masijade   User is offline

  • D.I.C Addict
  • member icon

Reputation: 196
  • View blog
  • Posts: 580
  • Joined: 03-April 10

Re: Is Java Really THAT Slow?

Posted 05 February 2011 - 06:33 PM

View PostSergio Tapia, on 05 February 2011 - 11:36 PM, said:

Java is considered "slow" because before you had to wait for the VM to start up. This used to be quite slow.

But now? Heh! You'd be hard to pressed to find a regular use case where a low level language like C is faster than Java.

Of course Java has a bad reputation of being slow because it was a pain in the ass from the user standpoint. I remember sometimes launching a Java based application (Limewire) and having to wait for the VM to load. Not cool!

Eventually it got much faster with things like:

The compiler got better at optimizing.
JIT compilation was added in Java 1.1 and improved significantly over the years, which can make Java code run at near native speed.
The libraries were improved and expanded giving you lots of things from the get go.
Garbage collection was vastly improved.

Edit: Why the negative rep?


Well, JIT compilation didn't really make it all that much faster, what made it faster is adaptive optimisation, introduced with the HotSpot compiler in the JVM. The class files byte code is not truely "compiled" data. The JVM still acts as an interpreter, interpreting the byte code into native functions, but the HotSpot compiler does this in such a manner that you don't even really notice it. If you run tests, however, repeating blocks of code many times over, you will notice that the first iteration of that is always slower than later iterations. That difference is the adaptive optimisation at work. ;-)
Was This Post Helpful? 2
  • +
  • -

#11 ishkabible   User is offline

  • spelling expret
  • member icon





Reputation: 1747
  • View blog
  • Posts: 5,898
  • Joined: 03-August 09

Re: Is Java Really THAT Slow?

Posted 05 February 2011 - 07:05 PM

i think the issue with java is that bad code runs slower than bad code in C/C++. but if you look at what the language offers(witch i have only recently recognized) it's to be expected. do you expect python to run as fast as java? of course not. it also offers extreme security witch is a big bonus. from what i have experienced java just needs to be optimized a bit more than C/C++ to be fast.
Was This Post Helpful? 0
  • +
  • -

#12 eker676   User is offline

  • Software Engineer
  • member icon

Reputation: 379
  • View blog
  • Posts: 1,833
  • Joined: 18-April 09

Re: Is Java Really THAT Slow?

Posted 05 February 2011 - 10:19 PM

People only remember the bad things. Everyone knows Hitler, but how many know you the current german president and chancellor are?

Java used to be slow. However, through the years it has evolved and become just a fast as any other language. I used to think Java sucked. But after using it for a few projects, I found that the common slow sterotype was false.
Was This Post Helpful? 0
  • +
  • -

#13 Mokgar   User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 113
  • Joined: 21-December 10

Re: Is Java Really THAT Slow?

Posted 06 February 2011 - 05:26 AM

Yes, I see I wasn't getting the whole slow part of java if I'm honest, I did realise how people are big on optimizing it though, which corroborates with the whole "Java can be as fast or even faster if programmed well" topic. Well fingers crossed that it eventually gets added, for me it would be useful.
Was This Post Helpful? 0
  • +
  • -

#14 ShakesSpears   User is offline

  • New D.I.C Head

Reputation: 6
  • View blog
  • Posts: 37
  • Joined: 07-October 08

Re: Is Java Really THAT Slow?

Posted 08 February 2011 - 08:24 AM

View PostDogstopper, on 05 February 2011 - 09:39 PM, said:

Apple is extremely proprietary. Did you see how they treated flash? I don't think Java will ever be...

I agree, being able to program would mean you could create content or functionality that apple has not approved. That seems to be the kind of thing Apple is very against at the moment.

EDIT: I don't mean to imply that apple is this big evil company. Rather, it is looking out for its best interests. The product that they are selling works rather well, in part because all of the software that runs on it meets some set of standards.

I personally don't like it being a relatively closed system. Attempting to control use of a product after its been sold seems wrong to me.

This post has been edited by INTERROBANG!?: 08 February 2011 - 08:37 AM

Was This Post Helpful? 1
  • +
  • -

#15 masijade   User is offline

  • D.I.C Addict
  • member icon

Reputation: 196
  • View blog
  • Posts: 580
  • Joined: 03-April 10

Re: Is Java Really THAT Slow?

Posted 08 February 2011 - 11:17 AM

View PostINTERROBANG!?, on 08 February 2011 - 04:24 PM, said:

EDIT: I don't mean to imply that apple is this big evil company. Rather, it is looking out for its best interests.


Like with the "shake the babay" application they approved? ;-)

Edit And they did approve it.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2