Data structure with 1 bilion possibilities but only around 200 actual objects

i wonder if you can help me.

I want to divide my scene into a lot of small cubes. Lets say 1000 x 1000 x 1000. But i will deal with only a couple hundreds of them… all others will be empty. In addition i don’t want to iterate through that couple hundred to find the one… i have three nice intigers which i belive i can use to point that object.
My first thing was just three dimensional array int[1000,1000,1000] which i would access by those three intigers nicely like object = array[2,5,7]. But this array would be really big and i don’t need it entirely. List would force me to iterate to find the object. Dictionary, i think it also iterate through keys to find the object.

Do you know some way to manage it optimally?

Thanks in advance and have a nice day!

the most optimally way of doing is using an array, and there is nothing more optimal, but you are right, working with a 1 billion size array.

You are expecting to add 1 billion gameobjects to an scene? because even using DOTS seems too much.

Its imposible to give you the perfect solution or advice without knowing why yoyu need the cubes and why only a couple hundres are not empty.

You should check some tutorials on how minecraft load cubes with “chunks”