-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
perf: Micro optimization EndsWith using #13084
perf: Micro optimization EndsWith using #13084
Conversation
You can test this PR using the following package version. |
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.
For EndsWith
with a single char
, .NET Core 2+ and .NET Standard 2.1 already have an optimized String.EndsWith(char)
.
Since we still need to target .NET Standard 2.0, can you please add its equivalent with conditional compilation to StringCompatibilityExtensions
and use it instead? This way we get the framework built-in one in .NET 6+ and we'll be able to easily remove the polyfill later without any other change.
You can test this PR using the following package version. |
What does the pull request do?
ToLowerInvariant().EndsWith
withEndsWith("string", StringComparison.OrdinalIgnoreCase)
value.EndsWith("%")
withvalue[value.Length -1 ] == '%'
What is the current behavior?
What is the updated/expected behavior with this PR?
small decrease in memory usage during build
How was the solution implemented (if it's not obvious)?
Checklist
Breaking changes
Obsoletions / Deprecations
Fixed issues