4 ms·
> As an example, in Java, everything is a pointer, so pointer chasing all the time, which is not good for cpu cache, etc Strictly speaking that's not true. It'
by re-thc 2y ago
> As an example, in Java, everything is a pointer, so pointer chasing all the time, which is not good for cpu cache, etc
Strictly speaking that's not true. It's everything is a pointer in theory to make it easier to reason with and JIT / JVM optimizing in the background.
There are primitive types and there are lots of tricks in the JVM e.g. escape analysis that places objects on the heap/stack etc.
- PhilipRoman 2y agoDespite all the advances in JIT, I've literally never seen it correctly optimize a HashMap<Integer> (happy to be proven wrong). Hopefully the renewed focus on value types can finally bring some sanity.
- neonsunset 2y agoIn C#, all struct generics are monomorphized and struct-based abstractions are zero-cost :)