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 FAR data from an immutable dictionary to an immutable array #73587

Merged
merged 15 commits into from
May 20, 2024

Conversation

CyrusNajmabadi
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi commented May 20, 2024

First commit moves us from an expensive immutable dictionary to a simple immutable array. As this array only ever holds a max of two items, the dictionary was gross overkill.

Second commit avoids lock overhead in a common case where the FAR window repeatedly asks the same entities for data after we tell it to refresh.

This drops us from about 35Msecs computation time on the client to around 31Msecs

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner May 20, 2024 16:03
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels May 20, 2024
{
additionalProperties.Add(containingMemberProperty);
if (node != null)
Copy link
Contributor

@ToddGrun ToddGrun May 20, 2024

Choose a reason for hiding this comment

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

if (node != null)

does this need to be nullable? #Closed

Copy link
Member Author

Choose a reason for hiding this comment

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

preserving existing code. and yes, it looks like it calls a helper that can return null.

@dotnet dotnet deleted a comment from ToddGrun May 20, 2024
Comment on lines 795 to 801
//private static bool TryGetAdditionalProperty(string propertyName, ISymbol symbol, out KeyValuePair<string, string> additionalProperty)
//{
// if (symbol == null)
// {
// additionalProperty = default;
// return false;
// }
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
//private static bool TryGetAdditionalProperty(string propertyName, ISymbol symbol, out KeyValuePair<string, string> additionalProperty)
//{
// if (symbol == null)
// {
// additionalProperty = default;
// return false;
// }

@@ -68,7 +69,7 @@ public async Task NavigateToAsync(NavigationOptions options, CancellationToken c
StandardTableKeyNames.Column => mappedSpanResult.LinePositionSpan.Start.Character,
StandardTableKeyNames.ProjectName => GetProjectName(),
StandardTableKeyNames.ProjectGuid => _boxedProjectGuid,
StandardTableKeyNames.Text => lineText.ToString().Trim(),
StandardTableKeyNames.Text => _trimmedLineText ??= lineText.ToString().Trim(),
Copy link
Contributor

Choose a reason for hiding this comment

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

lineText.ToString().Trim(),

Possible to not allocate twice?

Copy link
Contributor

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

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

:shipit:

@CyrusNajmabadi CyrusNajmabadi merged commit 0f56332 into dotnet:main May 20, 2024
25 checks passed
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants