logoalt Hacker News

za3farantoday at 6:57 AM1 replyview on HN

In real world systems, Java can beat programs in compiled languages like C++ and Rust when it comes to throughput and even latency.


Replies

imtringuedtoday at 8:21 AM

This is so untrue I still don't know how anyone can even claim this. When I run tests in Rust, the biggest portion of the time is spent compiling the test (lets say 3-4 seconds), then the tests conclude practically instantly, in less than half a second.

Meanwhile when I run tests on my JVM projects it can take 30 seconds just to start and the test execution is extremely slow too.

Even if you do manage to match the performance after warmup, you still have the issue that keeping the class files in RAM plus the JIT compilation state will cost more memory than simply running AOT compiled code. You simply cannot write processes that use a single digit MiB amount of memory on a JVM and getting down to 2 digits is theoretically possible but requires significant effort.

Once you get into the micro optimizations like the lack of mutable aliasing in Rust, there is significantly more potential for auto vectorization.

What you mean by "real world systems" is probably defined in such a narrow way that all the weaknesses of Java programs don't count anymore.

show 3 replies