Dynamo icon indicating copy to clipboard operation
Dynamo copied to clipboard

Improve startup and opening times by speeding up changes to recent files

Open dimven-adsk opened this issue 10 months ago • 0 comments

Purpose

Imagine you have 10 very large graphs in your recent files list. Every time the start page opens, it reads the entire contents of those files (plus any backup files), and then parses the content of each file twice! Then every time you open a new file, the whole process is repeated multiple times 😿

I propose we:

  1. Stream the files instead of reading their entire content.
  2. Skip the json validation (which forces us to pre-parse the file). It's not important why the file fails - Dynamo shouldn't be a json parser, just a json consumer. If the file is not a json or if the json content is malformed, you should use the right tool to figure that out.
  3. Read and store only the properties that are actually needed.
  4. Inline the description, author, etc. methods because they're not really needed.
  5. Implement a "quiet" observable collection for the recent files list. When you open a file, it is (1) removed from the list, (2), added to the front of the list, (3) if the max number of recents is exceeded, the list is truncated. These multiple actions force the start page to read the recents' properties multiple number of times.

The way the RecentFiles is used right now doesn't really necessitate an ObservableCollection and a list property would work just the same. However, in case that changes in the future, a quiet observable collection will preserve the flexibility.

image

Declarations

Check these if you believe they are true

  • [x] The codebase is in a better state after this PR
  • [x] 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
  • [x] This PR contains no files larger than 50 MB

Release 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) @mjkkirschner

(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

dimven-adsk avatar Jan 16 '25 16:01 dimven-adsk