Optimize ProjectDependencyGraph.DoesProjectTransitivelyDependOnProject #76399
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I believe that this method unnecessarilly obtains the reverse dependencies when the forward references are already defined. If the forward references are present, we should just use the result of trying to find the potential dependencies in it.
DoesProjectTransitivelyDependOnProject shows as 2.9% of allocations and 1.6% of CPU in the typing scenario in the scharp editing speedometer test. Will kick off a test insertion and see what those numbers are with this change.
*** CPU before change ***
![image](https://private-user-images.githubusercontent.com/6785178/395309787-c8952b63-f00d-4c66-b5fb-f7afa7345c07.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MTM3ODYsIm5iZiI6MTczOTYxMzQ4NiwicGF0aCI6Ii82Nzg1MTc4LzM5NTMwOTc4Ny1jODk1MmI2My1mMDBkLTRjNjYtYjVmYi1mN2FmYTczNDVjMDcucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMDk1ODA2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YTZlZDczMWVlM2FhNjY2MTI2NjEyZWE2NTAyMTExOGFkMDQwNDE5NjQ5YWI4Y2E5MDMyOTFjYmM0M2NlZmU3OSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.pq8-l2sQW8tCUS7T_mqh7T2-oOsQ8jUBVdMelPr4tsk)
*** Allocations before change ***
![image](https://private-user-images.githubusercontent.com/6785178/395309630-e25ac28f-e806-4326-bc1c-30b4fa43c8e2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MTM3ODYsIm5iZiI6MTczOTYxMzQ4NiwicGF0aCI6Ii82Nzg1MTc4LzM5NTMwOTYzMC1lMjVhYzI4Zi1lODA2LTQzMjYtYmMxYy0zMGI0ZmE0M2M4ZTIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMDk1ODA2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NTIzZTE5ZmQzYjJlNTUwMzA4MTc5NjY4ZTY0NTIyNDhmMWJlNWRlNjEwYmRjYzg2NTM3MmVkN2U0ZDhmZGI2MCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.j_mek0FOB1QzF-ORoDFpj-Iza5aurHXGp3LcXVKa2sU)