Generating 1000s of objects are really slow, how to optimize it? I am making this BPY script that basically generate boxes based on Vox file format for Magica Voxel. 

With my script, I am reading the position of each voxel and generate a Cube, as the number increases, over 2000 Blender started to become really slow.... I am only generating 8000 objects here, but possibly more.

I know the fact that Blender cannot have too many objects in the scene.

For what I am doing, what would be the best options? In reality, I could probably try generating a single mesh with point positions, for which I can use Dupli Verts for instancing the Box.

But is there other technique?

Is it much more efficient for Blender to have 10000 empty or objects under a single object?
I figured out that generating lots of objects is not the way to go. Instead we should always think of ways to merge the objects into a single object, however still having all the data and values needed.

In case of VOXEL and Magica Voxel or Drububu, my solution is to deal with Position, Color, to represent a Box of Voxel, and instance it thousands of times, however to always keep everything as a single object.