Optimize the undo buffer directly after setBlocks is invoked.