Optimization For a Huge Amount of 3D cubes