Ok so a little update on this:
Prior to leaving Edit Mode, the Undo is blazing fast for any changes you may have done in that Edit Mode session.
Problems start when you leave the Edit Mode and suddenly any Undo action costs lots of time (on big scenes) even if you manage to Undo your way into Edit Mode again.
I suppose this is a limitation of the implementation but could there be some feedback on how this is handled and what are the possible ways to improve the situation?
Selection objects (making them active) is also slow on big scenes but I found out that going into Local Mode alleviates this particular issue. Maybe if you enter Local Mode the Undo history could only be retained for this Local Mode session? This might be easier to implement and would nicely improve Local Mode role in Blender. The question here is this makes most sense in big files, so maybe checking Undo performance somehow would be good and pop-up saying “entering Local Mode, purge Undo?” and have that as hidden operator checkbox.
@sergey I read you worked on this a lot and I know there are other priorities but could you share your thoughts on this?