Hello @wuzelwazel,
Depending on the size and complexity of objects on your scene (namely on the objects that are processed with the script) adding an undo can be quite an expensive operation to execute. There was some recent work done that should affect the undo-stack in a positive way in the following releases.
Let me know if you have any further questions.
Cheers,
Ilia