Live data from Hacker News

Don’t call it a comeback: Java is still champ

github.com

151–160 of 557 posts

Re: Don’t call it a comeback: Java is still champ

#151

Earlier quoted context omitted.

>if I need to do low latency If the JVM is considered low latency I shudder to think what is high latency.

Java is pretty fast. Second most popular language in HFT. Can get it to a few tens of micros. Not as fast as C++ at sub 5 micros. So good enough for many latency sensitive apps.

> Not as fast as C++ at sub 5 micros.

Try sub 5 nanos. I was curious awhile ago at how fast C++ hash set lookup was compared to C#, and it consistently performed a lookup at 1 nanosecond. I tested with up to 6GB of data and then stopped because it was taking longer to generate random data then it was to run the benchmark 10,000 times.

C++ benchmarks here[0]. It's a bit more complicated then just a pure lookup since I was pulling some code out of a larger app, but the benchmark is only measuring the lookup speed. I did the C# benchmarks with BenchmarkDotNet or something like that, I can never remember the exact name.

[0]: https://gist.github.com/ambrosiogabe/66a6e2fdc77e6a600e570f4...

Re: Don’t call it a comeback: Java is still champ

#152
post #27

The only problem Java has is experienced C programmers don't build servers from scratch with it yet. Once they take that responsibility, the debate will be over because: "While I'm on the topic of concurrency I should mention my far too brief chat with Doug Lea. He commented that multi-threaded Java these days far outperforms C, due to the memory management and a garbage collector. If I recall correctly he said "only…

But what kind of C program is he comparing against? Single threaded ones? Not heavily optimized ones? Optimized concurrent C programs that use locks rather than lock-free data structures? Or heavily optmized C programs with lock-free data structure? It is unclear to me.

Also, wondering how much of that overhead in the C program is due to malloc (can be overcome by memory arena)

Re: Don’t call it a comeback: Java is still champ

#153
post #3

Earlier quoted context omitted.

Hmm Javascript has async though, no?

That's exactly what was meant. With Loom Java will hopefully not have the same function split as languages like JavaScript (or C# for that matter) where you have to add lots of async/await everywhere; and instead will have something like Go (where everything is async). https://journal.stuffwithstuff.com/2015/02/01/what-color-is-...

[deleted]

Re: Don’t call it a comeback: Java is still champ

#154
post #27

The only problem Java has is experienced C programmers don't build servers from scratch with it yet. Once they take that responsibility, the debate will be over because: "While I'm on the topic of concurrency I should mention my far too brief chat with Doug Lea. He commented that multi-threaded Java these days far outperforms C, due to the memory management and a garbage collector. If I recall correctly he said "only…

The p50 speed up from delaying memory management comes with a trade off, namely you get Garbage Collection pauses, bad p99, and spend your effort tuning the Garbage Collector instead of your code.

> tuning the Garbage Collector instead of your code.

This is a feature, not a bug. Which is riskier?

Re: Don’t call it a comeback: Java is still champ

#155

Earlier quoted context omitted.

My problem with Java is that C# exists which does huge portions of the stuff Java excels at just… better. Before, .NET only ran on Windows which disqualified it from many serious applications server deployments. Today, this is no longer the case for everything but cross platform GUI libraries, and even those are an option if you're okay with not having Linux support. It's more akin to the old car you had just before…

What stuff does C# objectively do better than Java?

Can't really be objective here. You could also argument this makes it worse, but it gives you to take shortcuts for things Java would make very hard or cumbersome (unsafe code, properties).

Re: Don’t call it a comeback: Java is still champ

#156
post #122

Earlier quoted context omitted.

That sounds a lot like the complaints about Java from a decade ago. Have you used it lately? Java's GCs are incredible and you have a menu of algorithmic options that let you avoid whatever problem you're worried about.

The JVM GC is fundamentally the same as 10 years ago.

Shenandoah did not exist 10 years ago, and G1 was not deployed.

Re: Don’t call it a comeback: Java is still champ

#157
post #44

Earlier quoted context omitted.

Have you explored Kotlin? It's really not just for Android.

I have, it's a nice language but I didn't like the mental tax of translating Java code to Kotlin in my head whenever I had to read up on how to do something I do intend to dig into it a bit more once I feel like I have mastered Java

I hear you, and had to do the same for a while. Eventually your brain migrates over and it becomes second nature. The ability to copy Java code and paste it as Kotlin helps tremendously, especially in the beginning.

Re: Don’t call it a comeback: Java is still champ

#158
post #5

Java's adequate. It's like a Toyota Corolla (insert your boring car of choice here if you don't feel this one works for the analogy). Not the prettiest, not the fastest, not the most efficient. But it gets you from point A to point B with little fuss or muss. I totally get why companies adopt and standardize on it. Do I use it for personal projects? Nope. Because it's not fun to "drive". For that, I pick the equivale…

My problem with Java is that C# exists which does huge portions of the stuff Java excels at just… better. Before, .NET only ran on Windows which disqualified it from many serious applications server deployments. Today, this is no longer the case for everything but cross platform GUI libraries, and even those are an option if you're okay with not having Linux support. It's more akin to the old car you had just before…

C# is like Java except your team can churn out new features 30% faster.

At least that is my experience running the only .NET team at a company that primarily runs Java.

Re: Don’t call it a comeback: Java is still champ

#159
post #116
post #87

Earlier quoted context omitted.

I have very vague knowledge of cars, but I know for a fact that your characterization of Java is just bad, no matter how good you car analogy-creation may be. I won’t even correct the others, but how come Java is unreliable? Like, I have a hard time thinking of anything in the category of computer programs that would fair better.

Have you ever had to maintain an old enterprisey Java thing? It's pure hell. Basic dependencies (like JUnit) break API compatibility every few years, and then they stop distributing the old version for new JVMs, so you're forced to port your code. The GC falls over in production at the least convenient times. People somehow decide everything should be stringly-typed, and that the best choice between .properties, xml…

> Have you ever had to maintain an old enterprisey thing? It's pure hell.

FTFY. And yes, I have worked on old Java apps, they are not worse than any other app that lived for a similarly long timeframe (and the fact that there seem to be more old monstrosity in Java may just mean that it actually manages to do its work written in java, and not fail in some other language).

Why don’t you have a bin repo for old junit versions? Nonetheless, not updating is just technical debt that will have to be paid once either way. Regarding GC, it was never as bad as its name in my opinion, but it improved dramatically in recent years. If it fails it is more than likely a programmer error (which is very easy to debug thanks to the JVM’s killer observability).

Regarding XML and .properties, this is related to enterprisyness not java, nor the JVM. These are meaningful abstractions to a degree but are overdone badly more often than not. Vendoring is not really a hack, it is a correct choice from the JVM’s PoV (in short, a canonical name and a classloader pair is unique inside the JVM), but it can be abused, and application servers kind of do so indeed.

Wtf, Java has probably the best tools when it comes to static analysis. It actually has a well-defined specification of what has to happen under nigh every circumstance, and Java is huge in academy as well so different kind of analysis is an active research topic, especially that Java is also huge in the industry.

Runtime exceptions are a thing everywhere, I again fail to see how are they relevant here, and Java is completely type safe with generics, your statement regarding that is completely false. If you don’t have casts in your program, it can’t fail with classcastexception (reflection-hackery aside).

Optionals are a mistake but the only fault lies in those who put a null inside.

Re: Don’t call it a comeback: Java is still champ

#160
post #5

Java's adequate. It's like a Toyota Corolla (insert your boring car of choice here if you don't feel this one works for the analogy). Not the prettiest, not the fastest, not the most efficient. But it gets you from point A to point B with little fuss or muss. I totally get why companies adopt and standardize on it. Do I use it for personal projects? Nope. Because it's not fun to "drive". For that, I pick the equivale…

My problem with Java is that C# exists which does huge portions of the stuff Java excels at just… better. Before, .NET only ran on Windows which disqualified it from many serious applications server deployments. Today, this is no longer the case for everything but cross platform GUI libraries, and even those are an option if you're okay with not having Linux support. It's more akin to the old car you had just before…

It's hard to see how C# will ever find wide usage outside of the MS ecosystem. It's so intrinsically tried to MS.
Post reply on HN