-
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
SqlBytes.Stream should consider overriding Span Read/Write methods #69921
Comments
Tagging subscribers to this area: @roji, @ajcvickers Issue DetailsSqlBytes.Stream can return a custom Stream class We should consider overriding the Span Read/Write methods on runtime/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLBytes.cs Lines 694 to 715 in 2a66135
That way callers using the Span-based APIs get better performance - an ArrayPool buffer doesn't need to be rented, and the data copied twice.
|
@eerhardt |
I think a contribution would be welcome. I don't think there is discussion other than "dev time". But I'd let the area owners confirm: |
Looks all internal optimization to me, so I can't see any reason we wouldn't welcome a contribution here.
|
SqlBytes.Stream can return a custom Stream class
StreamOnSqlBytes
and returns it to external callers. Since .NET Core 2.1,System.IO.Stream
has had Read and Write overloads that accept a Span to read to / write from. However, the base Stream implementation isn't optimized. To get the best performance when a caller is using the Span-based APIs, derived implementations of Stream are expected to override the Span-based APIs and perform the operation on the Spans. See theSystem.IO.Stream
section of #22387 for more information.We should consider overriding the Span Read/Write methods on
StreamOnSqlBytes
:runtime/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLBytes.cs
Lines 694 to 715 in 2a66135
That way callers using the Span-based APIs get better performance - an ArrayPool buffer doesn't need to be rented, and the data copied twice.
The text was updated successfully, but these errors were encountered: