Skip to content

Change SolutionState._lazyFilePathToRelatedDocumentIds to a ConcurrentDictionary #77959

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

Conversation

ToddGrun
Copy link
Contributor

@ToddGrun ToddGrun commented Apr 1, 2025

Measured changing lazyFilePathToRelatedDocumentIds by the following approaches during a load of Roslyn.sln:

  1. ImmutableDictionary (current)
  2. Standard Dictionary with a lock around it's usage
  3. ConcurrentDictionary

Stopwatch time spent in GetDocumentIdsWithFilePath (avg of 3 runs) (lower is better)

  1. 8.6 sec
  2. 9.7 sec
  3. 7.8 sec

ETL % of CPU time in GetDocumentIdsWithFilePath spent in ComputeDocumentIdsWithFilePath (higher is better)

  1. 96.6%
  2. 80.3%
  3. 97.5%

ETL % of allocations in GetDocumentIdsWithFilePath from ComputeDocumentIdsWithFilePath (higher is better)

  1. 26.1%
  2. 87.2%
  3. 50.0%

…tDictionary

Measured changing lazyFilePathToRelatedDocumentIds by the following approaches during a load of Roslyn.sln:

1) ImmutableDictionary (current)
2) Standard Dictionary with a lock around it's usage
3) ConcurrentDictionary

Stopwatch time spent in GetDocumentIdsWithFilePath (avg of 3 runs) (lower is better)
1: 8.6 sec
2: 9.7 sec
3: 7.8 sec

ETL % of CPU time in GetDocumentIdsWithFilePath spent in ComputeDocumentIdsWithFilePath (higher is better)
1: 96.6%
2: 80.3%
3: 97.5%

ETL % of allocations in GetDocumentIdsWithFilePath from ComputeDocumentIdsWithFilePath (higher is better)
1: 26.1%
2: 87.2%
3: 50.0%
@ToddGrun ToddGrun requested a review from a team as a code owner April 1, 2025 21:20
@ghost ghost added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 1, 2025
@ToddGrun ToddGrun requested a review from CyrusNajmabadi April 1, 2025 21:31
@ToddGrun ToddGrun merged commit bb0cb49 into dotnet:main Apr 2, 2025
25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants