Page MenuHome

Undo System: avoid redundant decoding on undo
ClosedPublic

Authored by Campbell Barton (campbellbarton) on Jul 13 2021, 9:29 AM.

Details

Summary

In most cases the undo system was loading undo data twice.

This was needed since some undo systems (sculpt, paint, text)
require stepping out of the current undo step.

Use a flag to limit this to the undo systems that need it.

This improves performance for other undo systems.
This gives around 1.96x speedup in edit-mesh for high-poly objects.


Running undo tests pass:

../lib/tests/ui_simulate/run.py --blender='./blender.bin --log "ed.undo.*" --log-level 1 --log-show-basename' --tests "*"

Diff Detail

Repository
rB Blender
Branch
TEMP-UNDO-SYSTEM-2X-FIX (branched from master)
Build Status
Buildable 15778
Build 15778: arc lint + arc unit

Event Timeline

Campbell Barton (campbellbarton) requested review of this revision.Jul 13 2021, 9:29 AM
Campbell Barton (campbellbarton) created this revision.
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)

No need to load the current state on redo, updated and added comment.

Campbell Barton (campbellbarton) retitled this revision from Undo System: avoid decoding undo data twice on undo to Undo System: avoid decoding data twice on undo when it's not needed.
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
  • Improve comment enter/exit -> before/after

Overall fully agree with the idea behind this change, not 100% sure about how safe it is currently though (think there are ways for code/API to change some data without proper undo dirty tagging, especially in the memfile case)... But am fine trying, we can always adjust things if issues arise.

source/blender/blenkernel/intern/undo_system.c
810–811

think this logic should be isolated in its own (inlined?) utils function... It's fairly hard to read inside a for loop imho.

This revision is now accepted and ready to land.Jul 13 2021, 11:24 AM
  • Extract turnary logic into function
Campbell Barton (campbellbarton) retitled this revision from Undo System: avoid decoding data twice on undo when it's not needed to Undo System: avoid redundant decoding on undo.Jul 13 2021, 11:43 AM