Skip to content
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

Add CopyToAsync optimized implementations for StreamPipeReader #52159

Merged
merged 11 commits into from
May 5, 2021

Conversation

manandre
Copy link
Contributor

@manandre manandre commented May 1, 2021

Closes #51972

/cc @davidfowl

@dotnet-issue-labeler
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@manandre manandre force-pushed the streampipereader-copytoasync branch from 1cdfd66 to a9e712f Compare May 1, 2021 16:34
@davidfowl
Copy link
Member

Thanks for the contribution @manandre. I'd prefer it if we didn't expose any code with the base implementation and instead optimized for calling as little functions inside of the CopyToAsync implementations inside of the StreamPipeReader itself.

I expected the calls to CopyToAsync to basically enumerate from readHead to readTail and copy that to the underlying destination (PipeWriter or Stream), and then in the Stream case, delegate completely to the Stream implementation. For the PipeWriter case, what you're doing is fine.

@manandre manandre force-pushed the streampipereader-copytoasync branch from fac46a9 to 347b061 Compare May 2, 2021 13:16
@davidfowl
Copy link
Member

This change is looking great! We need to figure out the tests.

@davidfowl
Copy link
Member

I'm very happy with this change @manandre!

@davidfowl davidfowl merged commit 4bbaa68 into dotnet:main May 5, 2021
@davidfowl
Copy link
Member

Thanks @manandre ! I will be looking for more Pipelines work to give you 😉

@davidfowl davidfowl added this to the 6.0.0 milestone May 5, 2021
@manandre manandre deleted the streampipereader-copytoasync branch May 5, 2021 09:25
@ghost ghost locked as resolved and limited conversation to collaborators Jun 4, 2021
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.

Implement optimized CopyToAsync for StreamPipeReader
2 participants