KEMBAR78
Improve slow searches involving installed items by JohnMcPMS · Pull Request #5701 · microsoft/winget-cli · GitHub
Skip to content

Conversation

JohnMcPMS
Copy link
Member

@JohnMcPMS JohnMcPMS commented Aug 28, 2025

Fixes #5629
(and probably quite a few more list/upgrade some-query-provided performance related issues)

While things could still be made better, the good case (where files were already cached locally) of the previous behavior trying to complete winget list Micro was taking 51 seconds. With this change, it takes 6 seconds on the debug build. Given that there is intentionally little to no I/O and much of the CPU time is likely spent in our code, that should speed up more with the release.

Issue

The indexed IPackage implementation for v2 needed to acquire the intermediate manifest to provide the response for GetVersionKeys. Since this is used extensively to perform correlation between available packages and local items during a search, any available packages found by the query would then result in a download/disk read of the intermediate manifest.

Change

Introduces IPackage::GetMultiProperty, allowing code that just wanted to get all of these values across all versions to do so more efficiently. For the v2 index, this is how the data is already stored in the database. For the other IPackage implementations, the data was also present and is just aggregated from each version's output.

Validation

Added test for calling new interface function.
Added validation across CompositeSource tests to ensure that the functions known to need non-indexed data are not called.

Microsoft Reviewers: Open in CodeFlow

yao-msft
yao-msft previously approved these changes Aug 29, 2025
case PackageVersionMultiProperty::PackageFamilyName:
for (std::string pfn : versionInfo.PackageFamilyNames)
{
Action(result, Utility::LocIndString{ pfn });
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: std::move(pfn) and same for several below?

Copy link
Member Author

Choose a reason for hiding this comment

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

I chose to go with properly using const& for the enumeration instead.

dkbennett
dkbennett previously approved these changes Aug 29, 2025
@JohnMcPMS JohnMcPMS dismissed stale reviews from dkbennett and yao-msft via ef42a12 August 29, 2025 22:35
@JohnMcPMS JohnMcPMS merged commit 4c85f5b into microsoft:master Aug 30, 2025
9 checks passed
@JohnMcPMS JohnMcPMS deleted the slow-list branch August 30, 2025 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Winget command --word --commandline --parameter freezes

3 participants