Skip to content

Conversation

@safesparrow
Copy link
Contributor

@safesparrow safesparrow commented Jun 18, 2023

Addresses most of the issues described in #15427 .

Change 1: speedup calculating FSharpCore dependency

We avoid calculating the same FSharpCore dependency for every file - we do it once and we avoid using filepath validation which was shown to be slow and is not necessary.

Change 2: speedup queryTrie

Do not memoize queryTrie - memoization is much more costly than the invocation itself, because it involves generating hash keys and comparing keys of type string list, and uses ConcurrentDictionary.
Also allow a dual query where two parts of the LongIdentifier as passed separately, avoiding the need to concatenate them into a new list.

This change vastly reduces the time for findDependencies calls.
Here is a DotTrace snapshot showing before:
findDependencies before
and after:
findDependencies after

* Avoid duplicate filename creation
* use concatenated identifier segments for memoization
@safesparrow safesparrow requested a review from a team as a code owner June 18, 2023 15:19
@safesparrow safesparrow marked this pull request as draft June 18, 2023 15:20
@nojaf
Copy link
Contributor

nojaf commented Jun 19, 2023

Great work!

@safesparrow safesparrow marked this pull request as ready for review June 19, 2023 07:56
@T-Gro T-Gro merged commit d632aa4 into dotnet:main Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants