-
-
Notifications
You must be signed in to change notification settings - Fork 108
perf: replace SubsString with alternative lookup
#4280
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
06c4bbb to
c43135f
Compare
SummaryReplaces Substring allocation with GetAlternateLookup on .NET 9+ in test discovery hot path, saving approximately 200KB. Critical IssuesNone found - approved SuggestionsNone - this is a well-executed performance optimization that targets a hot path per Rule 4, uses preprocessor directive for backward compatibility, maintains semantic equivalence with zero-allocation lookup, and doesn't require snapshot updates. The use of GetAlternateLookup with ReadOnlySpan is the correct modern approach for span-based HashSet lookups in .NET 9+. VerdictAPPROVE - Clean performance win with no downsides |
Use
GetAlternateLookupto avoid allocaing astringviaSubString.Edit: use preprocessor directive, apparently you can't polyfill
GetAlternativeLookupSmall improvement saves around 200KB