Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Optimize SqlClient SNIPacket async paths#34184

Merged
saurabh500 merged 5 commits into
dotnet:masterfrom
benaadams:snipacket-async
Dec 21, 2018
Merged

Optimize SqlClient SNIPacket async paths#34184
saurabh500 merged 5 commits into
dotnet:masterfrom
benaadams:snipacket-async

Conversation

@benaadams

@benaadams benaadams commented Dec 20, 2018

Copy link
Copy Markdown
Member

For ReadFromStreamAsync(Stream stream, SNIAsyncCallback callback)

await stream.ReadAsync(new Memory<byte>(...))
is a more efficient path than
stream.ReadAsync(byte[], ...).ContinueWith(Task => ...)

Move WriteToStreamAsync(Stream stream, ...) away from being async void

/cc @Wraith2 @saurabh500 @afsanehr @keeratsingh @stephentoub

Comment thread src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIPacket.cs Outdated
Comment thread src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIPacket.cs Outdated
Comment thread src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIPacket.cs Outdated
Comment thread src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIPacket.cs Outdated
@benaadams benaadams changed the title Optimize SNIPacket async paths Optimize SqlClient SNIPacket async paths Dec 20, 2018
Comment thread src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIPacket.cs Outdated
Comment thread src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIPacket.cs Outdated
@saurabh500

Copy link
Copy Markdown
Contributor

Looks like the netstandard targeted builds of SqlClient are failing. You may need to add the ValueTask specific code in separate files, or #if def them if the #ifdef is small.

System\Data\SqlClient\SNI\SNIPacket.cs(251,83): error CS0246: The type or namespace name 'ValueTask<>' could not be found (are you missing a using directive or an assembly reference?) [D:\j\workspace\windows-TGrou---0d2c9ac4\src\System.Data.SqlClient\src\System.Data.SqlClient.csproj]

Comment thread src/System.Data.SqlClient/src/System.Data.SqlClient.csproj Outdated
Comment thread src/System.Data.SqlClient/src/System.Data.SqlClient.csproj Outdated
Comment thread src/System.Data.SqlClient/src/System.Data.SqlClient.csproj Outdated
@benaadams

Copy link
Copy Markdown
Member Author

Seemed to do the trick; thank you for your help @saurabh500

picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
* Optimize SNIPacket async paths

* Feedback

* NET Core vs NET Std

* csproj

* Feedback


Commit migrated from dotnet/corefx@6870c4e
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants