logoalt Hacker News

opentokixtoday at 2:50 PM10 repliesview on HN

How about not using Java? Then you can have low latency.

Average go, rust, c++ and c will outperform amazing java programs, and the former will also be way way more easy to run, troubleshoot, interpret logs from.

Java is usch garbage in every stack.


Replies

SeanLuketoday at 3:05 PM

I need a UI which runs well on Windows, MacOS, and Linux, without having to build three different ones. Swing is still easily the best, most consistent, and most native-feeling cross-platform environment. It's much better than QT and GTK in most respects. And Java also runs elegantly on a little platform you may know as Android. I have high hopes for go and rust. But until they have mature UIs, they're out (for me).

C and C++ are dangerous languages filled with security failings and footguns, and no modern app should be written in them.

It's been my experience that well-written low-level Java code runs at about 75% the speed of good C code. (Of course lazy coders write in cushy Java which is much slower). When written efficiently, Java's biggest slowdown lies in array access (C and C++ array access is fast because it is very, very unsafe). But Java makes up for this in having a GC which will coalesce related objects into the same page and so take advantage of cache coherency effects in ways malloc and free cannot possibly do. I have some allocation-heavy algorithms in Java which are, as a result, significantly faster than well-written equivalents in C.

show 2 replies
ksectoday at 4:04 PM

>Java is usch garbage in every stack.

May be true between late 90s to late mid 10s. Both Java and JVM has had enormous of work going into it. 2026 the JVM is pretty damn good pieces of engineering.

motoboitoday at 2:58 PM

Rust? OK.

C++ or go? Then you'll have to take a very closer look, because the java JIT is wonderful. A masterpiece of several hands, actually.

show 2 replies
joe_mwangitoday at 4:40 PM

I've done some tests with current value classes in latest prototype with full optimisation through annotation. Apparently, everything was being compiled to assembly code with no gc calls. It seems this old school ideology of slow java is about to end in near future. I'm actually intrigued how it will compete with Rust which can't optimise code further while running, while JVM JIT has more info which it could aggressively further optimise, especially hot paths.

wolvesechoestoday at 6:13 PM

> Average go, rust, c++ and c will outperform amazing java programs

Everyone that has a minimal experience with these knows it is not true.

While performance ceiling is likely higher in C/C++/Rust (but not Go), when we move beyond microbenchmarks Java provides competitive performance with much better ergonomics. Not to mention strictly superior tooling.

pjmlptoday at 3:04 PM

It is a matter of skill.

cavoiromtoday at 2:57 PM

yes, until you need debugging.

re-thctoday at 3:10 PM

> Average go, rust, c++ and c will outperform amazing java programs

Not true. Many benchmarks have shown otherwise. it is at least competitive in many areas.

> and the former will also be way way more easy to run, troubleshoot, interpret logs from

No language will save you from poor logging practices. If you log every debug log it's not Java's problem. No 1 says you have to log the full stack trace if that's your concern. You can configure / strip / do anything. Learn to use the stack.

pestatijetoday at 3:19 PM

yeah...no, try low latency when running out of memory, or with more CPU-bound threads than cores...discipline vs almost impossible

ecshafertoday at 6:17 PM

Java is a great language and runtime. Java being slow is most often a pebcak scenario. There are massive, fast, low latency, Java systems out there that have been written by competent developers.

show 1 reply