3 ms·
That's exactly what I meant. In the case of int you can work around it using int[] but if you need more structure, like with a complex number type, or tuples, p
by fauigerzigerk 16y ago
That's exactly what I meant. In the case of int you can work around it using int[] but if you need more structure, like with a complex number type, or tuples, pairs, etc, the workarounds get really tedious. Basically what you can do is stuff it all into a large byte[] and deserialise on access. That's slow and kills productivity.
- points 16y agoIt's hardly a 'work around' :/ int[][] or reals int[] imaginaries int[]
- wtallis 16y agoJava's multidimensional arrays aren't stored contiguously in memory because rows can be different lengths. If you have an int[][] a, then a[1] is simply a pointer to an int[]. You can't escape the excess of pointers. If you try something like having an array for each component as a substitute for an array of structs, then that places fairly strict upper bounds on the length of the arrays before which you are guaranteed to have killed cache locality.