Hacker News new | ask | show | jobs
by abraxas 2315 days ago
Java can be as fast as Go if you are careful. Unfortunately idiomatic Java isn't terribly fast because of the pointer chasing behaviour in its collections. The only way to avoid the issue is to work primarily with arrays of basic numeric types. If you sort a large vector<Point3d> in C++ it will be an order of magnitude faster than sorting a similar looking ArrayList<Point3d> on Java because the C++ version stores and allocates these tiny objects in a contiguous memory block.
1 comments

Java is also going to take a ton more memory.
Java doesn't need the trick to allocate useless GB to force the GC to behave, like Twich and others have reported about.

I also bet that Java value types will be available in the language earlier than any Go compiler with generics support.

https://jdk.java.net/valhalla/