Improve startup performance #3257
Merged
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.
This PR improves startup performance and gets the user to an interactive state quicker by making the following changes:
CloudDrivesManager
andDrivesManager
have been removed fromSettingsViewModel
to allow app settings to be loaded and made available to launch the app as early as possible.CloudDrivesManager
andDrivesManager
are instantiated using an async singleton pattern with them being constructed as early as possible, while not delaying the launch of the UI should one of them require longer to complete.ICloudProviderDetector
's are loading asynchronously in parallel so thatCloudDrivesManager
only takes as long as the slowestICloudProviderDetector
. This is mainly whereOneDriveCloudProvider
relies on FullTrust and can be delayed by FullTrust loading slowly. With this design, all otherICloudProviderDetector
's can complete while waiting for the slowest one.In future there would be further opportunities to speed up the initial load by adding cloud drives to the UI individually as they load so that fast
ICloudProviderDetectors
appear straight away, and slower ones will gracefully appear in the UI a little later. However for now I don't feel any of theICloudProviderDetectors
's are slow enough to require even more changes.