Object creation slows over time
Some quick tests show that blender is designed to work with objects that have high vertex counts but not really with a large number of objects. Even with 3000 objects in a scene it takes a few seconds to select all objects, yet selecting the 33,000 vertices of those objects all joined together is almost instant.

I tested four ways to create multiple cubes.


Create 1000 cube objects - 8 seconds
Create a single mesh containing 1000 disconnected cube meshes - 0.5 seconds
As 2 then separate by loose parts to get 1000 cube objects - 5 seconds
Create a cube and a grid with 1000 verts, enable dupliverts and make real - 0.6 seconds


I am thinking your best approach would be to create a mesh that is a single plane with a vertex where you want each cube to be located, enable dupliverts, then if you want them separate for rigid body you can make the dupliverts real.

For info the script used to test these times is here.