You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In most cases ArrayPool returns an array that its length is bigger than the requested length.
So we usually use ArraySegment but its Offset field is unneeded. So having ArrayRange will be nice.
If we use Memory<T> with ArrayPool<T>, _index is always zero, isn't it ?
Only difference between ArrayRange and ArraySegment<T> or Memory<T> is Offset or _index removal which makes less stack copy.
In that case, do you have a benchmark that shows a realistic scenario (i.e. not a microbenchmark), where using ArrayRange would significantly improve performance?
In other words: if you want to introduce a new API whose sole reason for existing is improved performance, I think you should first show that it actually improves performance.
In that case, do you have a benchmark that shows a realistic scenario (i.e. not a microbenchmark), where using ArrayRange would significantly improve performance?
In other words: if you want to introduce a new API whose sole reason for existing is improved performance, I think you should first show that it actually improves performance.
I don't think ArrayRange give a significant performance improvement, so I'm convinced.
Activity
gfoidl commentedon Sep 19, 2018
Do
Memory<T>/Span<T>not suffice?moien007 commentedon Sep 19, 2018
ArrayRange is less complex than
Memory<T>andSpan<T>. AlsoMemory<T>contains_indexwhich is (if I'am not wrong) same asArraySegment<T>.Offset.svick commentedon Sep 19, 2018
Why is that an issue?
moien007 commentedon Sep 19, 2018
If we use
Memory<T>withArrayPool<T>,_indexis always zero, isn't it ?Only difference between
ArrayRangeandArraySegment<T>orMemory<T>isOffsetor_indexremoval which makes less stack copy.svick commentedon Sep 19, 2018
In that case, do you have a benchmark that shows a realistic scenario (i.e. not a microbenchmark), where using
ArrayRangewould significantly improve performance?In other words: if you want to introduce a new API whose sole reason for existing is improved performance, I think you should first show that it actually improves performance.
moien007 commentedon Sep 19, 2018
I don't think
ArrayRangegive a significant performance improvement, so I'm convinced.