Skip to content

Conversation

@zeusongit
Copy link
Contributor

Purpose

Based on #15759

The PR optimizes the way we load recent files, earlier we used to refresh the complete list of recent files, when launching dynamo, and then again when opening a graph, this was mainly done to fetch graph properties like thumbnail, description etc., to be displayed on the start page.
The optimization include handling events such as:

  • Opening a new file, which also adds it to the recent files will now not refresh the complete list, deserialize and add only the new item.
  • In case when adding to the list, increase the size of the recent files list beyond the maximum allowed recent files, it will trigger another refresh of the complete list, which is not mitigated by only removing the affected item from the list.
  • When an existing item is selected from the recent files list, simply move the location of that item, to the start of the list, instead of yet again refreshing the complete list.

There was another part of the PR by Reope, that deals with deserialization optimization for graphs, it will be addressed in a separate PR, as that requires more discussion.

Results:

Results depend on the user's list of recent files, if the user has bigger files it will take longer. For this example I tested with 5 big and 5 "normal" size files.

Name Size Time
PointSq 21 KB 4 ms
Test1 8 KB 1 ms
Autodesk-MaRS-office-example-v3 1372 KB 151 ms
Column_Builder_Grid 79 KB 4ms
Manekin 3100 KB 311 ms
Manekin 3100 KB 280 ms
Manekin 3100 KB 348 ms
Manekin 3100 KB 219 ms
Manekin 3100 KB 341 ms
Time taken to deserialize all files: 1721ms

(Total Time: 1721ms)
Before:
Action: Load Dynamo and Open any graph - Total time x2
Action: Load Dynamo and Open any graph (when recent files list at max items) - Total time x3

After:
Action: Load Dynamo and Open any graph - Total time x1
Action: Load Dynamo and Open any graph (when recent files list at max items) - Total time x1

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB

Release Notes

  • Optimize AddToRecent files working

Reviewers

@DynamoDS/eidos

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-8797

@zeusongit zeusongit requested review from a team, mjkkirschner and pinzart May 8, 2025 21:46
@aparajit-pratap
Copy link
Contributor

aparajit-pratap commented May 15, 2025

@zeusongit, not sure about the history here, but I see that there are a number of other changes in the original PR from the contractors. It's vastly different from this PR. Was it decided not to go ahead with those changes and move forward with this PR instead?

@zeusongit
Copy link
Contributor Author

@zeusongit, not sure about the history here, but I see that there are a number of other changes in the original PR from the contractors. It's vastly different from this PR. Was it decided not to go ahead with those changes and move forward with this PR instead?

Hey @aparajit-pratap, yes I did mention that in the description; there was another part of the PR by Reope, that deals with deserialization optimization for graphs, it will be addressed in a separate PR, as that requires more discussion.

@zeusongit zeusongit requested a review from Copilot May 20, 2025 17:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes the way recent files are managed in Dynamo by reducing unnecessary full list refreshes when only a subset of changes occur. Key changes include:

  • Replacing the PreferencesViewModel’s local UpdateRecentFiles call with dynamoViewModel.UpdateRecentFiles.
  • Switching from ObservableCollection to SmartObservableCollection for recent files and adding move logic for existing items.
  • Enhancing the StartPage handling to differentiate between full refreshes and partial list updates on collection changes.

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs Uses dynamoViewModel.UpdateRecentFiles and removes redundant local method.
src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs Switches to SmartObservableCollection and refines the AddToRecentFiles logic with inline documentation.
src/DynamoCoreWpf/Controls/StartPage.xaml.cs Adjusts recent files refresh behavior based on the type of collection change event, with support for full refreshes via a new flag.
Files not reviewed (1)
  • src/DynamoCoreWpf/PublicAPI.Unshipped.txt: Language not supported

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

@reddyashish reddyashish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zeusongit zeusongit merged commit 3b91079 into DynamoDS:master May 22, 2025
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants