I'm looping through 397 objects in my current scene and removing them all with the following code:
for obj, _ in instance_grp:
self.doc.AddUndo(c4d.UNDOTYPE_DELETEOBJ, obj)
obj.Remove()
I've timed the sub-section of the script where this is happening. When I AddUndo() here the script takes a total of ~4.3 seconds to run and this section in particular takes ~3.1 seconds.
If I comment out the AddUndo() line like so:
for obj, mtx in instance_grp:
#self.doc.AddUndo(c4d.UNDOTYPE_CHANGE, obj)
obj.Remove()
Then the total runtime of the script is ~1.2 seconds and this section takes ~0.09 seconds. This is unexpected. Is there something I could be doing differently; is this a bug?