-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Prefer Span<T>.Clear() over Span<T>.Fill(default) #33813
Prefer Span<T>.Clear() over Span<T>.Fill(default) #33813
Comments
Aside from the analyzer I can submit a PR changing |
Is there a rule-of-thumb on when |
@Joe4evr currently |
I'm going to remove this from the Roslyn Analyzers project for the time-being; we will add it back to the project once we get our triage process in place for prioritizing newly filed code-analyzer issues. |
@jeffhandley Any issues with me marking this ready for review? Seems straightforward enough. |
I feel like |
I count 9 references to |
No objections from me; thanks! |
Level: Info Looks good as proposed. |
@huoyaoyuan Consider this issue assigned to you. Edit: Can't assign it to you because you need to participate in this discussion. But consider it yours. |
@carlossanlop You can assign me now, and you can tell the owners to review the PR. |
@GrabYourPitchforks Probably also |
I'm afraid a branch will cause performance regression on small spans. |
Originally posted by @mavasani in dotnet/roslyn-analyzers#5181 (review) @bartonjs |
Thanks. We don't need VB support for analyzers about the use of span until such a time that VB has more than minimal support for spans. |
(Copied from #30740 (comment).)
Consider replacing this:
With this:
I see a handful of uses of
Fill(0)
orFill(default)
throughout the codebase (see callers). TheClear()
method is potentially much more optimized than theFill
method depending on the T in use.Category: Performance
The text was updated successfully, but these errors were encountered: