Skip to content

Conversation

@xtqqczze
Copy link
Contributor

@xtqqczze xtqqczze commented Aug 30, 2020

PR Summary

  • Refactor code to avoid LINQ Count method.

    • Full refactor of DoesCurrentRunspaceIncludeCoreHelpCmdlet method
  • Refactor method parameters to a type that implements ICollection<T> (for the Count property)

    • IEnumerable<TypeMemberData> -> Dictionary<string, TypeMemberData>.ValueCollection
    • IEnumerable<PropertySetData> -> List<PropertySetData>

    I choose not to use a ICollection<T> type because the enumerator may result in a heap allocation.

PR Context

PR Checklist

@ghost ghost assigned rjmholt Aug 30, 2020
@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Sep 2, 2020
@ghost ghost added the Stale label Sep 17, 2020
@ghost
Copy link

ghost commented Sep 17, 2020

This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 15 days. It will be closed if no further activity occurs within 10 days of this comment.

@ghost ghost closed this Sep 27, 2020
@iSazonov iSazonov reopened this Oct 16, 2020
@iSazonov
Copy link
Collaborator

@xtqqczze Is it still draft?

@ghost ghost removed the Stale label Oct 16, 2020
@xtqqczze xtqqczze changed the title WIP: Avoid LINQ Count method Avoid LINQ Count method Oct 22, 2020
@ghost ghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Oct 22, 2020
@xtqqczze xtqqczze marked this pull request as ready for review October 22, 2020 13:54
@iSazonov iSazonov added the CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log label Oct 22, 2020
@xtqqczze xtqqczze requested a review from rjmholt October 23, 2020 12:54
@ghost ghost added the Review - Needed The PR is being reviewed label Oct 30, 2020
@ghost
Copy link

ghost commented Oct 30, 2020

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@xtqqczze
Copy link
Contributor Author

@rjmholt Can you review the changes since your last review?

Copy link
Collaborator

@rjmholt rjmholt left a comment

Choose a reason for hiding this comment

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

@xtqqczze you didn't make the changes I asked for last time, your new refactor incorrectly changes the behaviour of the code, and there's no testing added to ensure lack of regressions.

Given the quantity of open PRs you have on PowerShell right now, I would ask that you:

  • Refocus your contributions for quality rather than quantity
  • Add tests in your contributions to enable us as maintainers to make the case that your contributions won't cause regressions

Please understand that this is a large and relatively old codebase, and due to its use as a programming language and library platform that's reflection-intensive, it is a lot more sensitive to regressions than many other .NET projects, meaning the maintainers try to be conservative with code mutations that aren't strictly necessary.

I'm happy to accept your contributions, but those contributions should:

  • Be well-scoped, both in terms of the domain and the code
  • Make a strong case for the proposed change in the PR description, about improving some factor like performance, code complexity or testing coverage, and ideally make it in a quantitative way
  • Add tests or identify in the PR description where testing pre-exists to identify regressions

For this PR, please:

  • Change the GetEnumerator() usage to a foreach
  • Add a test for the code path you're refactoring

@ghost ghost added Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept and removed Review - Needed The PR is being reviewed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept labels Oct 30, 2020
Address @rjmholt review

Co-Authored-By: Robert Holt <rjmholt_msft@outlook.com>
@ghost ghost added the Review - Needed The PR is being reviewed label Nov 9, 2020
@ghost
Copy link

ghost commented Nov 9, 2020

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@rjmholt rjmholt merged commit 1386d00 into PowerShell:master Nov 11, 2020
@ghost ghost removed the Review - Needed The PR is being reviewed label Nov 11, 2020
@xtqqczze xtqqczze deleted the remove-linq-count branch November 11, 2020 17:43
@iSazonov iSazonov added this to the 7.2.0-preview.1 milestone Nov 11, 2020
@ghost
Copy link

ghost commented Nov 17, 2020

🎉v7.2.0-preview.1 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants