This repository was archived by the owner on Jun 5, 2025. It is now read-only.
Improve VM data loading performance on Landing and SetupTarget pages. #2824
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.
Summary of the pull request
Loading and displaying Hyper-V VMs data on Landing and SetupTarget pages has a visible delay that is caused by several factors:
This PR:
Improves 1. by removing explicit "Is Hyper-V module loaded" checks that we don't need. To make more improvements in that area we will likely need to move away from PowerShell and use WMI.
Removes OOP calls from UI thread by fetching and caching Compute Systems data in parallel on thread pool before making model initialization call on UI thread.
Video before the change:
https://github.com/microsoft/devhome/assets/51001703/51fe0672-4b36-4674-82e9-2d47a4df2604
Video after the change:
https://github.com/microsoft/devhome/assets/51001703/b77b4602-6597-46aa-9c50-1441bad8914a
References and relevant issues
Enumerating the hyper-V VMs takes longer than the experience in Hyper-V Manager
Detailed description of the pull request / Additional comments
Added ComputeSystemPropertyCache and ComputeSystemCache classes for caching VMs data via lazy initialization. Once we replace usage of ComputeSystem class with ComputeSystemCache we can merge those classes.
PR checklist