Skip to content
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

Unroll LINQ usage to trim some allocations in AddMSBuildAssets #5584

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

Erarndt
Copy link
Contributor

@Erarndt Erarndt commented Jan 10, 2024

Bug

Fixes: NuGet/Home#13223

Regression? Last working version:

Description

Unrolls some LINQ usage to avoid allocation overhead.

PR Checklist

  • PR has a meaningful title

  • PR has a linked issue.

  • Described changes

  • Tests

    • Automated tests added
    • OR
    • Test exception
    • OR
    • N/A
  • Documentation

    • Documentation PR or issue filled
    • OR
    • N/A

@Erarndt Erarndt requested a review from a team as a code owner January 10, 2024 01:03
@ghost ghost added the Community PRs created by someone not in the NuGet team label Jan 10, 2024
@aortiz-msft
Copy link
Contributor

@Erarndt - Could we please get some microbenchmarking to understand any perf gains with this commit? This is a requirement for all changes done to improve performance.

@aortiz-msft aortiz-msft self-requested a review January 10, 2024 15:34
Copy link
Contributor

@aortiz-msft aortiz-msft left a comment

Choose a reason for hiding this comment

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

Needs perf benchmark as stated before.

Copy link
Member

@nkolev92 nkolev92 left a comment

Choose a reason for hiding this comment

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

Change looks good.

I think given that the linked issue is not directly related to the change here, I think it'd be save to just assume we need a new issue for these PRs.

@davkean
Copy link
Contributor

davkean commented Jan 10, 2024

@Erarndt Can you post the PerfView results blaming these allocations?

@aortiz-msft Unrolling LINQ is a well-known pattern that we've applied 1000s of times in this and other code bases. Micro-benchmarking a change like this adds a overhead to the contribution of these fixes and slows down the work. I think benchmarking should be saved for larger/riskier changes and not patterns we just know from experience are faster.

We've also contributed similar fixes in this codebase without micro-benchmarks.

@ghost ghost added the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Jan 18, 2024
@ghost
Copy link

ghost commented Jan 18, 2024

This PR has been automatically marked as stale because it has no activity for 7 days. It will be closed if no further activity occurs within another 90 days of this comment. If it is closed, you may reopen it anytime when you're ready again, as long as you don't delete the branch.

@ghost ghost removed the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Jan 18, 2024
@ghost ghost added the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Jan 25, 2024
@ghost
Copy link

ghost commented Jan 25, 2024

This PR has been automatically marked as stale because it has no activity for 7 days. It will be closed if no further activity occurs within another 90 days of this comment. If it is closed, you may reopen it anytime when you're ready again, as long as you don't delete the branch.

@ghost ghost removed the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Feb 6, 2024
@jeffkl jeffkl self-assigned this Feb 6, 2024
@aortiz-msft
Copy link
Contributor

Unrolling LINQ is a well-known pattern that we've applied 1000s of times in this and other code bases. Micro-benchmarking a change like this adds a overhead to the contribution of these fixes and slows down the work. I think benchmarking should be saved for larger/riskier changes and not patterns we just know from experience are faster.

Makes sense. Sorry, I didn't realize I had marked my comment as blocking.

@aortiz-msft aortiz-msft self-requested a review February 6, 2024 18:47
Copy link
Contributor

@jebriede jebriede left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@jeffkl jeffkl merged commit 2fc6cf7 into NuGet:dev Feb 9, 2024
16 checks passed
@Erarndt Erarndt deleted the dev-erarndt-AddMSBuildAssets branch March 1, 2024 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community PRs created by someone not in the NuGet team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unroll LINQ usage to trim some allocations in AddMSBuildAssets
6 participants