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

Improve performance on SymbolCompletionProviderTests #70307

Closed

Conversation

Rekkonnect
Copy link
Contributor

With approval from @CyrusNajmabadi, many tests in SymbolCompletionProviderTests were adjusted with new methods that allow checking for multiple items in the suggestions with a single run, hence improving performance.

This PR contains those adjustments for many tests that were the biggest hits, with either many verifications in the same method on the same source, or in test theories that have many distinct combinations.

Additionally, the new API makes it cheaper to test the available and displayed items more extensively.

Benchmarks

Running all the tests in SymbolCompletionProviderTests (about 830), takes:

  • Before: ~2.4 min
  • After: ~1.5 min

The performance aligns with the theory of each individual await Verify... doing unnecessary work to parse, etc. up until the completion is triggered, in order to a.

Notes

The new version removes seemingly unnecessary arguments and bathces each individual argument about a specific item in a record. These may be freely updated depending on the requirements for each test.

Test methods that only verify exactly one item are not meant to be updated.

@Rekkonnect Rekkonnect requested a review from a team as a code owner October 9, 2023 23:39
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Oct 9, 2023
@ghost ghost added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Oct 9, 2023
Comment on lines 259 to 263
var result = ImmutableArray.Create(
CompletionTestExpectedResult.Absent("String"),
CompletionTestExpectedResult.Absent("System")
);
await VerifyExpectedItemsAsync(code, result);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
var result = ImmutableArray.Create(
CompletionTestExpectedResult.Absent("String"),
CompletionTestExpectedResult.Absent("System")
);
await VerifyExpectedItemsAsync(code, result);
await VerifyExpectedItemsAsync(code, [
CompletionTestExpectedResult.Absent("String"),
CompletionTestExpectedResult.Absent("System")
]);

And so on and so forth.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I must definitely get used to collection expressions. You may cancel the current check runs.

@Rekkonnect
Copy link
Contributor Author

Closing in favor of #75496

@Rekkonnect Rekkonnect closed this Oct 12, 2024
@Rekkonnect Rekkonnect deleted the test-perf/symbol-completion/baseline branch October 12, 2024 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee. 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.

2 participants