Skip to content

Convert IEnumerables to Lists for perf improvements #691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed

Convert IEnumerables to Lists for perf improvements #691

wants to merge 8 commits into from

Conversation

alerickson
Copy link
Member

@alerickson alerickson commented Jul 7, 2022

PR Summary

Pervasive use of IEnumerables in primarily FindHelper and InstallHelper were causing some unexpected performances degradations. Occasionally the same call was (unexpectedly) occurring multiple times due to the fact that IEnumerable does not return a collection. This was particularly painful because it meant multiple, unnecessary server calls, which can hit the server hard, but also decreases performance of PowerShellGet.

PR Context

Resolves #654:

  • LINQ is generics and can cause multiple compiled methods calling search APIs.
  • Find code always returned IEnumerable interface, causing LINQ calls to call search APIs multiple times to manipulate IEnumerable as collections.
  • Dependency search returns IEnumerable which is then used as collection and calls server X times.
    retrievedPkgs = pkgMetadataResource.GetMetadataAsync(...)
    if (retrievedPkgs == null || retrievedPkgs.Count() == 0) ...
    foundPackagesMetadata.AddRange(retrievedPkgs.ToList());

PR Checklist

@alerickson alerickson requested review from PaulHigin and anamnavi July 7, 2022 19:33
@alerickson alerickson changed the title Convert IEnumerables to Lists for perf improvements [WIP] Convert IEnumerables to Lists for perf improvements Jul 13, 2022
@alerickson alerickson requested a review from PaulHigin July 19, 2022 23:07
@alerickson alerickson changed the title [WIP] Convert IEnumerables to Lists for perf improvements Convert IEnumerables to Lists for perf improvements Jul 19, 2022
@alerickson
Copy link
Member Author

Closing this PR in favor of #728

@alerickson alerickson closed this Jul 28, 2022
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.

[Performance improvements for find/install] Fix IEnumerable issues
2 participants