-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Refactor Span<T>.ToArray
#119462
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
base: main
Are you sure you want to change the base?
Refactor Span<T>.ToArray
#119462
Conversation
Refactor to reduce unsafe.
| Buffer.Memmove(ref MemoryMarshal.GetArrayDataReference(destination), ref _reference, (uint)_length); | ||
| return destination; | ||
| T[] array = new T[Length]; | ||
| CopyTo(array); |
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.
nit: Only this line needs to be changed to reduce unsafe.
destination is arguably a clearer name and the use of _length == 0 and new T[_length] isn't at all unsafe, plus it reduces inlining needs for a known perf critical type so we only have one path that actually needs inlining considerations.
|
Why is superpmi-diffs check skipped? |
It's only run for JIT changes, not all library changes. |
How can I check for Windows codegen regressions? |
Run jit-diff locally? or at least provide benchmarks. |
|
Tagging subscribers to this area: @dotnet/area-system-memory |
Refactor to reduce unsafe.