4 ms·
That's a good start that explains some of the memory overhead (along with the sizable Java object header), but we also need to take into account memory locality
by marginalia_nu 1y ago
That's a good start that explains some of the memory overhead (along with the sizable Java object header), but we also need to take into account memory locality to explain why this is so much slower.
Main memory access is at worst case order of 100x slower than a cached read. With boxed primitives you very often looking and main memory access, whereas naked primitives can (when the planets align) amount to cached memory access.