NuGet.Client icon indicating copy to clipboard operation
NuGet.Client copied to clipboard

Run the update status of installed and transitive packages in background

Open jebriede opened this issue 8 months ago • 0 comments

Bug

Fixes: https://github.com/NuGet/Home/issues/14256

Description

This change will yield the packages list to the caller before it finishes running the expensive operations to populate extra metadata for the Installed packages. Previously, the expensive operations were being synchronously ran and blocking the caller thread until finished, causing the packages list to not be returned for display until the versions and metadata was also fetched, along with some other computations that happened beforehand.

Taking the duration measurement (in milliseconds) for the PMUIRefresh when VS.NuGet.RefreshSource is PackageManagerLoaded for the after and before cases, using OrchardCore as the same solution, and loading the Solution PM UI produced these results:

Run Before Duration After Duration
Run 1 65332.9408 25299.8169
Run 2 16534.3167 15328.2072
Run 3 17677.6345 14312.8415
Run 4 19484.0274 11848.4951
Run 5 17657.166 12855.6119

The average runtime for the Before durations is 27337.22 ms and for the After durations is 15928.99 ms. The percentage increase in performance from the After duration compared to Before is 41.73%. Removing the outliers from the Before and After (the highest and lowest), the increase in performance from the After duration compared to Before is 22.48%.

These metrics are subject to variation depending on the user's network and other computer factors. However, the slower the network connection, the greater the improvement is expected to be.

The behavior change is that the packages list will load faster on the Installed tab and the Versions, Metadata (including vulnerability information and deprecations) will be computed in the background and updated as soon as available. This will drastically reduce the time until a user can interact with the packages list in the PM UI.

PR Checklist

  • [x] Meaningful title, helpful description and a linked NuGet/Home issue
  • [ ] ~~Added tests~~
  • [ ] ~~Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.~~

jebriede avatar Apr 18 '25 21:04 jebriede