Skip to content

Conversation

jasonmalinowski
Copy link
Member

A bunch of small improvements:

  • Make CanConvertMetadataReferenceToProjectReference take ProjectStates rather than the IDs and doing the lookups. The ID -> State lookup is O(log n), but doing that a lot on a high traffic method like that was showing up in traces.
  • Rather than looping through IDs and then grabbing states in ConvertMetadataReferencesToProjectReference, we can just loop across states directly.
  • Avoid calling CanConvertMetadataReferenceToProjectReference if there's no references, which is common during load where we might know all the output paths up front but not the references which come in later.
  • Use DoesProjectTransitivelyDependOnProject when checking for P2P references, which takes advantage of the map in either direction.

A bunch of small improvements:

- Make CanConvertMetadataReferenceToProjectReference take ProjectStates
  rather than the IDs and doing the lookups. The ID -> State lookup is
  O(log n), but doing that a lot on a high traffic method like that was
  showing up in traces.
- Rather than looping through IDs and then grabbing states in
  ConvertMetadataReferencesToProjectReference, we can just loop across
  states directly.
- Avoid calling CanConvertMetadataReferenceToProjectReference if
  there's no references, which is common during load where we might know
  all the output paths up front but not the references which come in
  later.
- Use DoesProjectTransitivelyDependOnProject when checking for
  P2P references, which takes advantage of the map in either direction.
@jasonmalinowski jasonmalinowski requested a review from a team as a code owner June 27, 2025 00:24
@jasonmalinowski jasonmalinowski self-assigned this Jun 27, 2025
@jasonmalinowski jasonmalinowski merged commit 9403340 into dotnet:main Jun 27, 2025
26 checks passed
@jasonmalinowski jasonmalinowski deleted the perf-optimizations-for-project-reference-conversion branch June 27, 2025 02:27
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jun 27, 2025
@RikkiGibson RikkiGibson modified the milestones: Next, 18.0 P1 Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants