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

Using Nullable Disabled semantic model to compute semantic classification #71036

Merged

Conversation

maryamariyan
Copy link
Member

@maryamariyan maryamariyan commented Nov 30, 2023

Summary:

Using new API (#70609) to get semantic model with nullability analysis disabled

Report

I completed my investigation, what I see is that the changes reduce the overhead on EnsureNullabilityAnalysisPerformedIfNecessary when we are computing semantic classifications

I have 4 cases:

  1. ALWAYS: when nullability analysis enabled ALWAYS
  2. DEFAULT (Using new APIs): when nullability analysis is not set (DEFAULT) - Using new APIs to get Nullable Disabled Semantic Model
  3. NEVER: when nullability analysis is disabled NEVER
  4. DEFAULT (Original Semantic Model): when nullability analysis is not set (DEFAULT) - Without new APIs, using Original Semantic Model

perfview comparison:

Summary: This confirms when we use nullable disabled semantic model for semantic classification the computation of nullability analysis drops and overall semantic classification computation becomes faster. Note that AddSemanticClassifications in the caller list drops from 4% to ~0%

Case # 2 with new APIs (Using nullable disabled semantic model)
image

Case # 4 (currently shipped)
image

stopwatch comparison:

Summary: This shows an average of 372ms reduced to 132ms when we try to compute semantic classification on a large razor file.

Case # 2 (Using nullable disabled semantic model)
image

Case # 4 (currently shipped)
image

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 30, 2023
@ghost ghost added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Nov 30, 2023
@maryamariyan maryamariyan force-pushed the dev/maryamariyan/perf-analysis-semtokens branch from f028dbf to 47ad5ce Compare December 5, 2023 23:32
@maryamariyan maryamariyan changed the title Draft - testing out new API to get semantic model with nullability analysis disabled Using Nullable Disabled semantic model to compute semantic classification Dec 14, 2023
@maryamariyan maryamariyan marked this pull request as ready for review December 14, 2023 21:10
@maryamariyan maryamariyan requested review from a team as code owners December 14, 2023 21:10
@@ -71,8 +71,8 @@ dotnet_diagnostic.RS0006.severity = error
dotnet_diagnostic.RS0012.severity = warning
dotnet_diagnostic.RS0014.severity = warning
dotnet_diagnostic.RS0015.severity = warning
dotnet_diagnostic.RS0016.severity = error
dotnet_diagnostic.RS0017.severity = error
dotnet_diagnostic.RS0016.severity = none # PROTOTYPE(ndsm): re-enable
Copy link
Member

Choose a reason for hiding this comment

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

Should the PROTOTYPE comments in this PR be addressed?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's from @RikkiGibson 's commit. I would have to refer back to him to see how this needs to be updated.

Refer to commit d6262f6 in this PR


Also refer to this pipeline run:

  • Seems like the roslyn-CI (Correctness Correctness_TodoCheck) task also caught this PROTOTYPE comment :)

Copy link
Contributor

Choose a reason for hiding this comment

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

First step I think is to present the findings to API review. They may want revisions to names, shapes, etc. of the API but any changes should have pretty small impact on this PR.

My commits haven't yet been reviewed by compiler team so we will need 2 compiler team reviews on the PR as well. I would be fine with just pushing commits to this PR to address any feedback.

This specific prototype comment will be addressed by re-enabling the error and updating the public API files.

@RikkiGibson RikkiGibson self-assigned this Jan 30, 2024
@maryamariyan maryamariyan requested a review from a team as a code owner February 1, 2024 00:14
- This commit would be sufficient if decide to not do AB/testing
- Tested locally using WorkspaceConfigurationOptionsStorage to set feature flag
- Changes here may be used if we want to do A/B testing

Note: I commented out
`globalOptions.GetOption(DisableNullableAnalysisInClassification)`
and sets to
WorkspaceConfigurationOptions.DisableNullableAnalysisInClassification
property to true directly in my tests.
- Tested locally using ClassificationOptions to set
  feature flag
  - Changes here may be used if we want to do A/B testing

  Note: I commented out
  `globalOptions.GetOption(DisableNullableAnalysisInClassification,
  language)`
  and set
  ClassificationOptions.DisableNullableAnalysisInClassification
  property to true directly while testing this change locally..

Use ClassificationOptions to set feature flag
…allow for AB testing

TODO
- [ ] Confirm if AB testing is needed.
If not, then I can revert back to 2c79db4
- [ ] Otherwise, test with global options, using this commit (I only tested previous commits locally)
System.Composition.Hosting.CompositionFailedException : Exported contract type 'IWorkspaceService' is not assignable from part 'DefaultClassificationConfigurationService'.
- Removes Feature flag setup
- Reverts content back to 2c79db4
@CyrusNajmabadi
Copy link
Member

done with pass.

Copy link
Member

@CyrusNajmabadi CyrusNajmabadi left a comment

Choose a reason for hiding this comment

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

ide side LGTM.

@RikkiGibson RikkiGibson enabled auto-merge (squash) February 27, 2024 01:22
@RikkiGibson RikkiGibson merged commit 662557c into dotnet:main Feb 27, 2024
26 of 29 checks passed
@jjonescz jjonescz added this to the 17.10 P2 milestone Feb 27, 2024
@maryamariyan maryamariyan deleted the dev/maryamariyan/perf-analysis-semtokens branch February 28, 2024 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers 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.

None yet

8 participants