In the undomanager the following is performed every time an action is performed.
while (nextIndex > 0
&& getNumberOfUnitsTakenUpByStoredCommands() > maxNumUnitsToKeep
&& transactions.size() > minimumTransactionsToKeep)
If you have a transaction made up of thousands of actions, and you are undoing the current transaction and redoing it every time the mouse moves, this can get really slow. So, now I only let the above code run if it is a new transaction. Do you see any problem with that?