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

Switch CreateNodeAsync to an iterative approach #5624

Merged
merged 8 commits into from
Feb 23, 2024

Conversation

Erarndt
Copy link
Contributor

@Erarndt Erarndt commented Feb 6, 2024

Bug

Fixes: NuGet/Home#13222

Regression? Last working version:

Description

This change updates the implementation of CreateNodeAsync to avoid async state machine allocations (<CreateGraphNodeAsync>d__3) caused by recursion. In larger restores, these were a significant amount of allocations (:

AsyncStateMachineAllocs

After:
image

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 February 6, 2024 20:12
@ghost ghost added the Community PRs created by someone not in the NuGet team label Feb 6, 2024
@jeffkl jeffkl self-assigned this Feb 7, 2024
@jeffkl
Copy link
Contributor

jeffkl commented Feb 7, 2024

@nkolev92
Copy link
Member

nkolev92 commented Feb 8, 2024

@jeffkl You can run the CI on refs/pull/5624/head to get the checks published.

@jeffkl
Copy link
Contributor

jeffkl commented Feb 8, 2024

@jeffkl You can run the CI on refs/pull/5624/head to get the checks published.

I can it against refs/pull/5624/merge here: https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=9041709&view=results Does it have to be refs/pull/5624/head instead? That would be funny

@nkolev92
Copy link
Member

nkolev92 commented Feb 8, 2024

The checks are based on the commit sha on top of the branch, so you have to use head

@jeffkl
Copy link
Contributor

jeffkl commented Feb 8, 2024

The checks are based on the commit sha on top of the branch, so you have to use head

Thanks for the tip! I've started CI again but this time the checks are coming through 🎉

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.

Beyond allocations, are there wall clock improvements?

I know @jeffkl's running substrate, but we probably want more data here.

// do not add nodes for all the centrally managed package versions to the graph
// they will be added only if they are transitive
foreach (var dependency in node.Item.Data.Dependencies)
int index;
for (index = currentState.DependencyIndex; index < node.Item.Data.Dependencies.Count; index++)
Copy link
Member

@nkolev92 nkolev92 Feb 9, 2024

Choose a reason for hiding this comment

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

Aren't we losing some of the parallelism we had here previously?
Now the graph is walked completely synchronously.

@dotnet-policy-service dotnet-policy-service bot 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 Feb 20, 2024
Copy link
Contributor

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.

@Erarndt Erarndt force-pushed the dev-erarndt-iterativeWalk branch from 5d12337 to c3e2bf5 Compare February 20, 2024 23:11
@dotnet-policy-service dotnet-policy-service bot 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 20, 2024
@jeffkl jeffkl merged commit 39c4f37 into NuGet:dev Feb 23, 2024
16 checks passed
@Erarndt Erarndt deleted the dev-erarndt-iterativeWalk branch February 28, 2024 19:23
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.

CreateWalkAsync should not be recursive
3 participants