We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
void Pattern(int len) { Span<byte> span = (uint)len > 1024 ? new byte[len] : stackalloc byte[len]; span.Clear(); Consume(span); }
Here JIT is expected to avoid calling Clear for new byte[len] path. Also, it should avoid it at all unless SkipLocalsInit is set.
new byte[len]
Currently, in order to avoid this perf impact, developers complicate their code.
The text was updated successfully, but these errors were encountered:
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch See info in area-owners.md if you want to be subscribed.
Sorry, something went wrong.
Honest question, how often is span.Clear() called in such patterns? I personally haven't done that ever at all I think.
span.Clear()
it's from BCL, in some cases we have to call Clear() because we know that SkipLocalsInit is defined globally.
No branches or pull requests
Here JIT is expected to avoid calling Clear for
new byte[len]
path. Also, it should avoid it at all unless SkipLocalsInit is set.Currently, in order to avoid this perf impact, developers complicate their code.
The text was updated successfully, but these errors were encountered: