WhenDuring a mesh transforming a Mesh into Edit Modeation in edit mode (Move, Rotate...), some updates should be ignored in favor of optimizationnot the entire draw cache needs to be recreated.
Among the most time-consuming operations are called operations due to `DEG_id_tag_update(tc->obedit->data, ID_RECALC_GEOMETRY)`:
- deg_evaluate_copy_on_write - The MeshBut this occurs because `DEG_id_tag_update(tc->obedit->data, although not changedID_RECALC_GEOMETRY)`, is completely copied and the batch cache is completely destroyed.
- chain a call to `BKE_object_data_batch_cache_dirty_tag - Tags` that tags all the batch cache to be redone
This patch proposes a solution to skip mesh CoW during a transnot tag dirty All, but only what participates in the deformation and not tag dirty Alln of geometry.
**Depsgraph Changes:**
Currently, the graph can be compared to this simplified one:
{F10187860}
Where `DEG_id_tag_update(id, ID_RECALC_GEOMETRY)` would triggers `geom_eval_mesh` andor `geom_eval_obj_init`.
And `DEG_id_tag_update(id, ID_RECALC_SELECT)` would trigger `tag_dirtys `update_select_mesh` and `tag_dirty` or `update_select_obj`.
This patch proposes to separate `"tag_dirty"` from `"geom_eval"` and create a separate node for it (`update_all` in the image bellow).
In addition to adding a optionan node to `tag_dirtyupdate_deform_only``
The graph becomes something like this:
{F10187861}94537}
The new `ID_RECALC_GEOMETRY_DEFORM` also doesn't trigger CoW.
**Disadvantages:****Benchmarking:**
- Some might say that the graph is too complex and difficult to maintain.||master:|patch:
- `ID_RECALC_GEOMETRY_DEFORM` could further crash if misused since the loose element cache would not be freed.
**Alternative solution:**|---|---|---|
|large_mesh_editing:|Average: 16.727632 FPS|Average: 26.424897 FPS
||rdata 9ms iter 26ms (frame 60ms)|rdata 0ms iter 19ms (frame 38ms)
|large_mesh_editing_ledge:|Average: 17.761902 FPS|Average: 28.070558 FPS
||rdata 9ms iter 24ms (frame 56ms)|rdata 0ms iter 18ms (frame 36ms)
|looptris_test:|Average: 5.537827 FPS|Average: 5.456050 FPS
||rdata 11ms iter 26ms (frame 169ms)|rdata 11ms iter 28ms (frame 172ms)
|subdiv_mesh_cage_and_final:|Average: 2.095824 FPS|Average: 2.140402 FPS
||rdata 7ms iter 21ms (frame 242ms)|rdata 0ms iter 20ms (frame 237ms)
||rdata 7ms iter 22ms (frame 233ms)|rdata 0ms iter 21ms (frame 227ms)
|subdiv_mesh_final_only:|Average: 6.626541 FPS|Average: 7.974115 FPS
||rdata 3ms iter 13ms (frame 145ms)|rdata 0ms iter 10ms (frame 122ms)
|subdiv_mesh_final_only_ledge:|Average: 6.590914 FPS|Average: 7.978224 FPS
Instead of using `DEG_id_tag_update` we could update everything we need in the operator itself and somehow trigger the Geometry dependent objects to be updated.||rdata 3ms iter 13ms (frame 143ms)|rdata 0ms iter 10ms (frame 121ms)