With the optimized undo datablock pointers remain the same, so Cycles can now update just the parts that changed.