-
Notifications
You must be signed in to change notification settings - Fork 636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
delay graph execution when adding/modifying multiple nodes at once #11230
Conversation
@pinzart90 now that you've removed the Run step, when and where does the Run actually take place? |
Dynamo/src/DynamoCore/Graph/Workspaces/UndoRedo.cs Lines 52 to 56 in 17f1104
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment.
looks like 7 test failures. |
Thanks, casting issue. Should be fixed now |
// that they were done (due to inter-dependencies among components). | ||
// | ||
for (int index = actions.Count - 1; index >= 0; index--) | ||
using ((undoClient as WorkspaceModel)?.BeginDelayedGraphExecution()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the syntax is pretty neat.
There are a few diffs here that are hard to read - are there really that many changes or is that all from wrapping that code in an outer using statement? |
I think we should probably add simple unit tests for this new class to enforce its behavior though I guess it would be "covered" by its usage as part of undo/redo? |
Changes are simple, it;s just the indentation of the wrapped code. |
Wanted a review before adding tests. I will need to add specific tests to target this functionality (even for undo/redo) |
/// Class is thread safe, although behavior is not well defined. | ||
/// Nested instance of this class do not have a well defined behavior. | ||
/// </summary> | ||
internal class DelayedGraphExecution : IDisposable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm - I like the new design, what about DelayedWorkspaceExecution
for a name? Or is that an implementation detail rather than an API one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, I'm not convinced that is better or worse
@QilongTang if you are going to tackle undo/redo moving of nodes you may want to look at this new internal functionality. |
{ | ||
workspace.delayGraphExecutionCounter--; | ||
} | ||
workspace.RequestRun(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a RequestRun
call, I think, at the end of each of these actions - undo, redo, convertnodetocode
etc, so why call it again here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DelayedGraphExecution
can be used in other cases, besides the ones I covered in this PR
The DelayedGraphExecution
class does not know that there will be a RequestRun called after it is used.
In the cases of undo, redo, convertnodetocode etc
the requestRun calls (after DelayedGraphExecution
) will not register any UpdateGraphAsyncTasks, because there will be no more dirty nodes.
Please Note:
DynamoRevit
repo will need to be cherry-picked into all the DynamoRevit Release branches that Dynamo supports. Contributors will be responsible for cherry-picking their reviewed commits to the other branches after aLGTM
label is added to the PR.Purpose
https://jira.autodesk.com/browse/AGD-1801
Fix slow undo, copy paste, nodeToCode (basically operations applied on many nodes at once that might trigger recomputation).
Added mechanism to delay graph execution (instead of creating many UpdateGraphAsyncTasks for each node that is modified, we create a single UpdateGraphAsyncTask that will contain all modified nodes)
Changes to code follow the example bellow:
Declarations
Check these if you believe they are true
*.resx
filesReviewers
(FILL ME IN) Reviewer 1 (If possible, assign the Reviewer for the PR)
(FILL ME IN, optional) Any additional notes to reviewers or testers.
FYIs
(FILL ME IN, Optional) Names of anyone else you wish to be notified of