WIP: Defer node view loading to speed up opening times (and possibly UX) of large graphs. #15784
+232
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
This PR is similar in idea to what Bogdan proposed here, but tackles the problem from the xaml, instead of the code-behind. That way we don't have to make any changes to the node content.
Instantiating the node views is a very large chunk of the overall graph loading times (from starting to parse the json to rendering the content and having Dynamo respond to user input). It scales disproportionately to the number of nodes, such as with the more nodes you have, the greater the percentage of time it eats up. On the MaRS graph, with about 700 nodes, it roughly takes a quarter of the time:
Unfortunately, we can't do much about this, other than to delay the loading until it's absolutely needed. By default this PR will only display the nodes and annotations that are in the visible portion of the graph and load their view, when they first become visible:
This greatly speeds up the loading times, but the new problem with this approach, is that if you pan/zoom the view and all of a sudden a lot of nodes become visible at the same time, the UI thread will freeze until they are loaded. Again, this doesn't get rid of the problem, it just breaks it down into smaller chunks :D
Current graph loading and navigation:
![DynamoSandbox_wihtwgprbS](https://private-user-images.githubusercontent.com/123701487/406947351-e77c8361-bc3f-4daa-b8d8-bbb287246fd4.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxMzE3MDMsIm5iZiI6MTczOTEzMTQwMywicGF0aCI6Ii8xMjM3MDE0ODcvNDA2OTQ3MzUxLWU3N2M4MzYxLWJjM2YtNGRhYS1iOGQ4LWJiYjI4NzI0NmZkNC5naWY_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOVQyMDAzMjNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kNDliMjg1OThlOWJlNmRhNDg5Y2JiZTYyNWM1NGEzMDk5OWIxMmFmNjEzZGYxNDY5ZjNhZmM0OTRhY2JmYjhhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.aEzYDCbpEm5SBkagNurae7_rPEOx3CbFxP_6nB6sShI)
Deferred graph loading and navigation:
![DynamoSandbox_k03eBXOnM0](https://private-user-images.githubusercontent.com/123701487/406947445-b2ad430c-7b13-438c-8bf8-de60c5be14ab.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxMzE3MDMsIm5iZiI6MTczOTEzMTQwMywicGF0aCI6Ii8xMjM3MDE0ODcvNDA2OTQ3NDQ1LWIyYWQ0MzBjLTdiMTMtNDM4Yy04YmY4LWRlNjBjNWJlMTRhYi5naWY_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOVQyMDAzMjNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01Yjg4MmM2Njc2MTA4YWIyMGEyOTVlMmVhMDNkNThmOTAxMTU3YjcwY2FlNDE5MTJkODI3YWEzNjkyYjE1YzYzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.hP7g8tLArAUULrUtojvJ7OmLt6Yi8zljRLVs2Z7KcQM)
I think that this method has a lot of value. However, I've been struggling with it for a while and I haven't come up with a good way of reducing the UI freeze :/
I'm hoping you can take a look and propose some new ideas.
"Collapsing" the hidden workspace elements, should also improve the overall navigation performance, because we have less controls to load and render, less pixels to paint, less objects to participate in hit tests, etc. However I don't have a good way of measuring that. Using the application timeline captures some of this, but is very hard to compare between multiple timelines.
Declarations
Check these if you believe they are true
*.resx
filesRelease Notes
(FILL ME IN) Brief description of the fix / enhancement. Use N/A to indicate that the changes in this pull request do not apply to Release Notes. Mandatory section
Reviewers
(FILL ME IN) Reviewer 1 (If possible, assign the Reviewer for the PR)
@mjkkirschner , @pinzart90
(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