Code takes more time to run the more complex the scene gets
This is a common issue related to unique name lookup.

When an object is added to scene, blender ensure the name is unique.
So the more objects you add, the more time each one require for the name lookup.