4 ms·
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
by abraxas 7y 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.
- LessDmesg 7y agoJava is also going to take a ton more memory.
- pjmlp 7y agoJava 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/ https://jdk.java.net/valhalla/