I built my Minecraft-like block-world using 3d-Arrays of Objects (Block[x,y,z]).
Then i read everywhere that Jagged Arrays are much better performance wise. So I changed the whole code from 3d-Arrays zu Jagged Arrays with 3 Level depth (Block[y][z]).
It still works, but my benchmarking shows that EVERYTHING (from level build to block manipulation/Chunk rebuild) takes up to 2 times longer…
So now I’m reverting to the earlier version with 3D-Arrays.
Can somebody explain why Jagged Arrays actually seem to be slower than Multidimensional ones? Or is the problem that I changed all my foreach-loops to layered for-loops? That would be strange as well because for loops are supposed to be faster than foreach…
I’m confused…