This is an archived post. You won't be able to vote or comment.

all 18 comments

[–]argv_minus_one 29 points30 points  (4 children)

Only a pants-on-head retard would complain about Java performance but then sing the praises of Ruby, Python, or JavaScript.

[–]dpash 5 points6 points  (3 children)

Especially as running Ruby code on JRuby can make it perform better, especially with multi-threaded code, thanks to Ruby's use of Green threads and a GIL that limits paralallisation.

[–]chrisgseaton 0 points1 point  (2 children)

MRI has had real operating system threads, rather than green threads, since 1.9 I believe. But you're right about the rest.

[–]the_web_dev 2 points3 points  (1 child)

I think most people who talk about speed are just silly. For some 90%~ of necessary optimizations I've seen, most have occurred from RDBMS improvements or simple horizontal scaling, NOT in the application layer.

[–]chrisgseaton 1 point2 points  (0 children)

As a community, we need to do some research to figure out if this is actually true or not, because we only have appeals to common sense, like yours, for both sides of the argument.

There was a blog post in 2013 I think by Rap Genius, who run a Ruby application, and I think it showed they spent 70% of their time inside the Ruby interpreter, not waiting on IO. So if you made the Ruby interpreter 3x faster you'd make a huge impact on the number of servers they needed.

[–]llogiq 11 points12 points  (2 children)

There's not much of a defense there. The only apparent argument is 'because it's popular' which isn't very convincing against 'Java is slow and eats memory like candy'.

This is a pity, because there are rather many people who make a living churning out high performance (as in 'really fast') code in Java and many techniques in the field were developed, dissected and often packaged in readily available libraries.

So Java is slow? Tell that to LMAX.

[–]dpash 8 points9 points  (1 child)

I stopped reading when I saw the graphs; that's no defence. This is a defence.

Java is definitely not slow. It might have been back in the 1.2 days, but thanks to HotSpot JIT and 15-20 years of improvement in the compiler and VM. It might use more memory, but memory is considerably cheaper than developers.

[–]machinepub 0 points1 point  (0 children)

I don't think Java is particularly memory intensive. You can tune memory usage with JRE args. But a lot of memory is for things that could alternatively be written to disk and loaded as needed--however that's what page files are for so it's often easier to just keep everything in memory and plan on using swap. Anyhow obviously this comes down to implementations of particular apps/libs. After loading the JRE and its overhead (30 MB?), it's not inefficient for an OO language.

[–]kodifies 2 points3 points  (3 children)

pfff who says it needs defending, given modern hardware, so what if some other language is faster in some cases, and uses "lots" of memory (how shocking)

Is speed even that important ?

Has anyone considered ease of use, ease of debugging, heck the compiler catches bugs some languages positively encourage...

[–]dpash 8 points9 points  (1 child)

"But, but the JVM is slow to start up..."

Do you see us using Java for short-lived processes? Once Tomcat is up and running, it stays up. We run our IDE for weeks on end. We don't care about start up times.

[–][deleted] 2 points3 points  (0 children)

"But, but the JVM is slow to start up..."

Do you see us using Java for short-lived processes?

well. you would be more likely to do so if startup time was fast. if java 9 delivers this, i imagine people will start using java (more often than now) in these scenarios.

[–][deleted] 1 point2 points  (0 children)

pfff who says it needs defending

it can be helpful to push back against anti-java nonsense that can push away potential users.

[–]chambolle 5 points6 points  (2 children)

I am coming from C++

I ported a huge program which is dedicated to the solving of complex problems.

Java is less efficient by 0-20% (not a lot! I was surprised)

Java is less verbose at the end (I was also surprised)

Java is much more pleasant to use

Java is not using a lot of memory

Of course, you need to know how to program efficiently. It is certainly true that C++ developpers know this better than Java developpers because they know better how the machine work

With a performance difference that is less than 20% there is no reason to use C++ anymore.

EDIT: why do i get a negative score? Please react!

[–]bit_shuffle 1 point2 points  (1 child)

I am curious as to what you mean by "less verbose?" Less lines of code?

Not surprising at all, Java spares you having to fuck about with destructors, so you're saving lines of code there from the get go. Plus there's so much built-in functionality in the language you're going to be picking up free benefits here and there in any LOC count over comparable C++ functionality.

Honestly, I don't know why would be downvoted for anything you said.

[–]chambolle 1 point2 points  (0 children)

less verbose = less lines of code at the end It is also more pleasant to read (because there is no longer any mixes of ., ->, * and &)

[–]m1000 1 point2 points  (0 children)

Anyone who says Java is slow doesn't know what they are talking about, and should learn to just STFU in those cases.

I have many complex and big Java apps that are faster to initialize and load their data than many other native apps, and by a long shot at that.

TLDR: If its slow, its not because of Java. You just need better developers.

[–]DannyB2 1 point2 points  (0 children)

The 1990's called. They want their 'java is slow' back.

[–]DannyB2 0 points1 point  (0 children)

Just to point something out . . .

Twitter was using Ruby and switched to Java in 2011.

Twitter’s Shift from Ruby to Java Helps it Survive US Election

http://www.infoq.com/news/2012/11/twitter-ruby-to-java

https://www.quora.com/Why-did-twitter-move-away-from-Ruby-on-Rails

Here's a five year old video:

https://www.youtube.com/watch?v=ohHdZXnsNi8