Re:Memory Safe Languages in Android 13
by goodpoint on Thursday December 01, 2022 @03:39PM
(#33822390)
The claim that performance are comparable only on "toy benchmarks" is false.
[ Parent
| on HN ]
Toy benchmarks give JVM an edge because JVM optimizes code locally. Small amount of code in a benchmark means a majority of it can be inlined and then the JVM can actually remove a lot of Java-specific overhead like heap allocations, at least theoretically (I've seen it utterly fail in some cases even on toy benchmarks, though). However in bigger programs JVM has no way to optimize the inherent overheads stemming from the design of the Java language.
Rust and C++ don't have those overheads from the start, and then on top of that their compilers can do whole program optimization because they have plenty of time and resources to do so.