-
Notifications
You must be signed in to change notification settings - Fork 199
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
Convert SemanticRange to a struct + add RazorRange #9184
Conversation
...icrosoft.AspNetCore.Razor.LanguageServer/Semantic/Services/RazorSemanticTokensInfoService.cs
Outdated
Show resolved
Hide resolved
...icrosoft.AspNetCore.Razor.LanguageServer/Semantic/Services/RazorSemanticTokensInfoService.cs
Outdated
Show resolved
Hide resolved
@@ -29,20 +39,27 @@ public SemanticRange(int kind, Range range, int modifier, bool fromRazor) | |||
/// </summary> | |||
public bool FromRazor { get; } | |||
|
|||
public int CompareTo(SemanticRange? other) | |||
public int CompareTo(SemanticRange other) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Improve CompareTo
- Get new benchmarks
- Confirm tests pass
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/SemanticRange.cs
Outdated
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Models/RazorRange.cs
Outdated
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Models/RazorRange.cs
Outdated
Show resolved
Hide resolved
I noticed even by just making At first I thought it has to do with copy allocations but even making This could be due to having List operations on
|
Going over other commits I tried for perf improvement, but none seemed to make significant changes e.g. with diff in 616cb25: before
after
Closing PR. |
Contributes to #9092
I noticed even by just making
SemanticRange
struct from the original class actually increases allocation size for our existing benchmarks.At first I thought it has to do with copy allocations but even making
readonly struct
fromstruct
does not change the allocation size.This could be due to having List operations on
SemanticRange
inTagHelperSemanticRangeVisitor
andRazorSemanticTokensInfoService
.