Live data from Hacker News

If Java Is Dying, It Sure Looks Awfully Healthy

drdobbs.com

71–80 of 327 posts

Re: If Java Is Dying, It Sure Looks Awfully Healthy

#71
post #44
post #25

Earlier quoted context omitted.

I'm fairly certain Java and C++ have comparable speeds, and I think in someways Java's faster.

Java is not as fast or faster than C(++). The assertion always makes me cringe. I won't say Java is slow(though the startup time is annoying for some tasks), as it does perform better than many languages. But how does it make sense to you that a platform written in C can produce results faster than C is capable of?

I agree that C code is currently faster than Java in most benchmarks:

http://benchmarksgame.alioth.debian.org/u32q/benchmark.php?t...

There is no contradiction that a compiler written in a language with expensive semantics (say python), could compile a program written in another language (say C) to produce highly efficient machine code.

The JVM operations, such as JIT compilation and garbage collection, are bound by the performance of C code.

The performance of the code you write depends significantly on the quality of the machine code produced by the JIT compiler. This quality of this code is not theoretically dependent on the implementation language of the JIT.

Re: If Java Is Dying, It Sure Looks Awfully Healthy

#72
post #60

I've run the Java Users' Group in Philadelphia for almost 14 years, and I specialized in Java recruiting between 1999-2010. I know a lot of Java pros. Our meetings still get pretty strong attendance (80-120 per meeting), but I'm seeing far fewer new sign ups and the faces are much the same. There could be several reasons, but young engineers that I speak with rarely have any interest in Java work (though JVM is still…

I have 0 interest in learning Java, the language, to a professional level.

The JVM on the other hand, with things like JRuby and being able to use popular Java libraries and things like TorqueBox, is incredibly cool.

Re: If Java Is Dying, It Sure Looks Awfully Healthy

#73
post #58
post #25

Earlier quoted context omitted.

I'm fairly certain Java and C++ have comparable speeds, and I think in someways Java's faster.

Many painful minutes spent with slow-like-sloth-taking-a-shit Java desktop software lead me to believe that your statement isn't entirely true.

Your ignorance of the difference between server and client side Java leads me to believe that you're probably wrong.

Re: If Java Is Dying, It Sure Looks Awfully Healthy

#74

Earlier quoted context omitted.

I don't think the industry is driven by academia. Plus, no CS degree program worth the paper it's printed on even claims to teach Java. If yours did, I'd ask for a refund. Typically schools USE Java to teach computer science topics, for instance my university used it in the Intro course, where we learned program flow control and some OO principles, and in our Data Structures course where it was nothing more than a to…

All of our (the CS degree program I attended) 100s/200s courses in the late 90's were taught using C. From what I remember they didn't "claim" to use any particular language and basically if they did I wouldn't have known what they were referring to anyway. Java came onto the scene with much fanfare. It was a big thing and all the professors were quick to foist it upon us. On a side note, it’s funny for me whenever a…

I also remember all of the courses taught in C (with some C++ for OOP).

I find it really odd, though, working in a University environment and seeing the massive number of students in Java courses while IT is trying to limit the installation of the JVM on clients (especially Windows), as it's one of the major infection vectors on the campus (another being Flash).

Personally, I learned Java for Android/Blackberry development (guess that makes it half dead for me), but I also learned Objective-C for iOS/OS X development. I don't really see myself using either for any other environment, though.

I guess I'm just glad I never really dreaded learning/using any particular language.

Re: If Java Is Dying, It Sure Looks Awfully Healthy

#75

I primarily use java in my day job, and although there's a lot not to like about it, some standard complaints are somewhat overblown. For example, nothing really forces you to use long variable/method names, but even if you do, a modern IDE -- I use IntelliJ -- with auto-completion makes these fairly painless. It's not like you have to type every letter of "SomeClass.veryLongMethodName()" -- rather, you type "SomeCla…

Most standard complaints are over 10 years old, people should just get over it. The IDEs are a little fat and I/O hungry. If you don't have a beefy machine, just get a SSD, and that problem is gone.

Spring is great, but JavaEE6 simplified things further standardising things like CDI, JPA, JSF, Jersey, etc... (also, JavaEE7 was just released).

It's actually a pleasure to write web apps in Java nowadays. Great IDEs, debugging tools, lots of mature options, unlike some cool kids..

Re: If Java Is Dying, It Sure Looks Awfully Healthy

#76
post #60

I've run the Java Users' Group in Philadelphia for almost 14 years, and I specialized in Java recruiting between 1999-2010. I know a lot of Java pros. Our meetings still get pretty strong attendance (80-120 per meeting), but I'm seeing far fewer new sign ups and the faces are much the same. There could be several reasons, but young engineers that I speak with rarely have any interest in Java work (though JVM is still…

I have 0 interest in learning Java, the language, to a professional level. The JVM on the other hand, with things like JRuby and being able to use popular Java libraries and things like TorqueBox, is incredibly cool.

This is fairly common it seems, and one of the reasons my JUG (and some others) have modified our guidelines from a Java language focus to a focus on anything Java language or JVM. It has opened things up and allowed us to dive into some topics that will keep our audience more engaged.

Re: If Java Is Dying, It Sure Looks Awfully Healthy

#77
post #66
post #51

Earlier quoted context omitted.

What language do you think your favorite C compiler is written in? Now compare that C compiler to the jvm compiler, which has the benefit of using detailed information about the exact system configuration and other runtime behaviours during its compilation phases. Which one has the advantage?

C to both of your questions. The JVM compiler compiles for the JVM, which is written in C. So, how again can something written in C perform faster than...something written in C? I'm not claiming that line by line transcription, C will always perform each particular operation faster than Java. But the fact that you could write the entire JVM in C means that you could recreate the exact platform and replicate the resul…

Both the JVM and a C compiler produce native machine code that is executed by the processor directly. Neither is an interpreter in the classic sense[1]. It doesn't matter what language they're written in -- you could write C compiler or a JVM in PHP (assuming it can make the syscalls to load object code at runtime). No matter how awful the performance of the PHP runtime is, it would not prevent the C or Java program executed from being fast (in the long run).

Because the eventual target is native code, the only limit on performance[2] is what program transformations the compiler is willing to perform. This is limited by how much information the compiler has, and what sort of transformations are valid in the language.

For the first, it's about a wash. Java has a mix of 'safety' features that may obligate inserting checks at runtime that C would assume away, but it also forbids a lot of things that a C compiler would have to accept that limit the ability to optimize programs. In particular, a C compiler has to make a lot of pessimistic assumptions about what all those pointers are doing and what happens to memory across an external function call.

JVMs have a solid advantage in the second -- it performs the equivalent of profile guided optimization at runtime against real usage patterns, something that AFAIK no C compiler even attempts... and the runtime tooling needed to turn C into something you could JIT-optimize would result in something I don't think most C programmers would recognize.

A third issue is GC, which is on by default in Java-land and off by default in C: if your program is under very little memory stress and has very complex memory access patterns, the overhead of malloc()/free() is going to be huge compared to the cost of running the occasional GC. But, if your program is under strong memory stress and the logic to determine when to malloc() and when to free() is trivial, GC overhead will be a serious issue.

None of this means a given Java environment is faster than a given C environment but there's not really anything you could assume from first principles that makes one faster than the other. Neither reaches the ultimate "speed of light" of computation that is self-modifying hand-tuned machine code favored by all Real Programmers[3].

But the real bottom line for performance is which language has faster library implementations, and which has idioms that programmers actually use that produce faster or slower code. Those considerations are probably going to be way more important than the hypothetical top speed of a perfect program made by cycle-counting weenies. It's also the sort of thing you'd have to run actual experiments at large scale to answer.

[1] the JVM might interpret Java bytecode that isn't frequently run based on some optimization heuristic, but it doesn't have to. A 100% JIT emitting JVM could exist, and might even be a JVM flag for all I know.

[2] if you ignore the time JVM spends optimizing at load/JIT time, which you can in most cases aside from startup time.

[3] http://www.catb.org/jargon/html/story-of-mel.html

[4] Despite this extensive apology for Java, I despise it and if I never have to touch it or the JVM ecosystem again it will be too soon.

Re: If Java Is Dying, It Sure Looks Awfully Healthy

#78
Java is a pretty boring language, it must be said. But that's what makes it so good for real world usage - its got a lot of library support and many issues tend to have been ironed out already. Couple of weeks ago I was using Selenium's WebDriver SDK with a Ruby client program. It failed in some obscure TCP/IP stack error coming out of the C Ruby implementation. Using a java client just worked.

Re: If Java Is Dying, It Sure Looks Awfully Healthy

#79

Earlier quoted context omitted.

You can get all of that and clearer writing in c#, with Intellisense.

I hope I get no down votes from the following comment. This is not true, C# can be thought as superior to Java, only if you intend to be completely immersed in the Microsoft stack and this assertion is still debatable. I personally like Java more than C# just because Java is truly platform independent and fully open source. When you have two similar software products the one which is open source will always be a bett…

To be fair, Mono exists, and contains a free implementation of C#.

Re: If Java Is Dying, It Sure Looks Awfully Healthy

#80
post #66
post #51

Earlier quoted context omitted.

What language do you think your favorite C compiler is written in? Now compare that C compiler to the jvm compiler, which has the benefit of using detailed information about the exact system configuration and other runtime behaviours during its compilation phases. Which one has the advantage?

C to both of your questions. The JVM compiler compiles for the JVM, which is written in C. So, how again can something written in C perform faster than...something written in C? I'm not claiming that line by line transcription, C will always perform each particular operation faster than Java. But the fact that you could write the entire JVM in C means that you could recreate the exact platform and replicate the resul…

> So, how again can something written in C perform faster than...something written in C?

Easy. JVM has runtime information it can use that C compiler simply doesn't have. There are some synthetic benchmarks that show how "java is faster than C".

Post reply on HN