Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Amortize StreamPipeReader ReadAsync calls #39450

Conversation

benaadams
Copy link
Member

@benaadams benaadams commented Jul 13, 2019

@benaadams benaadams force-pushed the Amortize-StreamPipeReader-ReadAsync-calls branch from b1caddb to 0480d0d Compare July 13, 2019 16:50
@benaadams
Copy link
Member Author

Raised issue for Json failure https://github.com/dotnet/corefx/issues/39451

@benaadams benaadams force-pushed the Amortize-StreamPipeReader-ReadAsync-calls branch 2 times, most recently from 83e7d5c to db29225 Compare July 14, 2019 01:14
@davidfowl
Copy link
Member

Another concern I have is test coverage, how many tests this new code path?

@benaadams benaadams force-pushed the Amortize-StreamPipeReader-ReadAsync-calls branch from 1135099 to 866a947 Compare July 14, 2019 12:50
@benaadams
Copy link
Member Author

Another concern I have is test coverage, how many tests this new code path?

Is quite covered.

Not covered:

Flow EC for Competion trigger; throw for not reading on completion (should never happen)

image

Zero read and unknown exception

image

@benaadams
Copy link
Member Author

benaadams commented Jul 14, 2019

That's with adding new test to check for throws on concurrent reads

@benaadams benaadams force-pushed the Amortize-StreamPipeReader-ReadAsync-calls branch 3 times, most recently from 7e783ef to 8a4e64f Compare July 14, 2019 23:01
@@ -4,7 +4,7 @@
<Configurations>netstandard-Debug;netstandard-Release</Configurations>
<!-- We only plan to use this ref in netcoreapp. For all other netstandard compatible frameworks we should use the lib
asset instead. -->
<PackageTargetFramework Condition="'$(TargetGroup)' == 'netstandard'">netcoreapp2.0</PackageTargetFramework>
<PackageTargetFramework Condition="'$(TargetGroup)' == 'netstandard'">netcoreapp3.0</PackageTargetFramework>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joperezr would this be a correct change? Were some R2R issues with this package previously for ASP.NET that were fixed with #38731

ASP.NET now currently only targets netcoreapp3.0 and I was having packaging issues trying include a reference for ManualResetValueTaskSourceCore until I reached this current state. While it complies and packages, is it correct for ASP.NET's packaging?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mm I'm not sure why you would want to do this change, even if ASP.NET is targeting netcoreapp3.0, if they reference the package they would still get the netcoreapp2.0 asset resolved, which is what you want here right? I don't have full context on this change but I don't think doing this is correct. cc: @ericstj

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would want ASP.NET to resolve the netcoreapp3.0 asset; don't want a netcoreapp2.0 asset as it needs the extra downlevel Microsoft.Bcl.AsyncInterfaces assembly

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it won't be a netcoreapp2.0 asset, it will be a netstandard reference assembly and it will be the same one you will get no matter how you package it. If you really want to not depend on AsyncInterfaces, then you would need to cross compile the reference assembly for netcoreapp3.0. What this line here is doing, is simply telling our infrastructure to grab the assembly that targets netstandard2.0 and package it as if it was cross-compiled for netcoreapp2.0, but it still has the same dependencies. What you really want here, is to add a netcoreapp3.0 target on the configurations.props of this ref project so that we actually target netcoreapp3.0 and won't have the dependency. Does that make sense?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you prefer, I'm happy to push a change directly in your PR to fix this configuration issue and to make sure that the package is built correctly and that you won't get AsyncInterfaces dependency in ASP.NET.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love that! :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, that last changed I pushed should fix this and produce the right package.

@benaadams benaadams force-pushed the Amortize-StreamPipeReader-ReadAsync-calls branch 2 times, most recently from 8a4e64f to bef7c43 Compare July 15, 2019 10:54
@danmoseley
Copy link
Member

@stephentoub I assume this is post 3.0?

@stephentoub
Copy link
Member

From my perspective, yes.

@benaadams benaadams force-pushed the Amortize-StreamPipeReader-ReadAsync-calls branch from 14d07e2 to 31bb136 Compare July 17, 2019 00:45
@davidfowl
Copy link
Member

I love this change but want to figure out the bcl.async thing.

@benaadams
Copy link
Member Author

I love this change but want to figure out the bcl.async thing.

Think is fixed now?

@benaadams benaadams force-pushed the Amortize-StreamPipeReader-ReadAsync-calls branch from 82401ef to 6051a3e Compare July 20, 2019 11:45
@karelz karelz added this to the 5.0 milestone Aug 3, 2019
@maryamariyan
Copy link
Member

Commenting to revive this PR. Seems like this was halted just as a matter of waiting post 3.0.

cc: @anurse @jkotalik as area owners and @benaadams as PR creator

@benaadams
Copy link
Member Author

Packaging is still not happy with it :(

@ericstj
Copy link
Member

ericstj commented Aug 8, 2019

D:\a\1\s\.dotnet\sdk\3.0.100-preview7-012630\Microsoft.Common.CurrentVersion.targets(2106,5): error MSB3245: Could not resolve this reference. Could not locate the assembly "System.Threading.Tasks.Extensions". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [D:\a\1\s\src\System.IO.Pipelines\ref\System.IO.Pipelines.csproj]

Reference assemblies need to use ProjectReferences in most cases. Only exceptions are for frameworks that aren't building any more (eg: past NETCoreApps and NETStandards), in which case we've disabled those configurations and restore them from past packages.

@benaadams
Copy link
Member Author

Probably want to hold on this for now until dotnet/coreclr#26310 is evaluated

@stephentoub stephentoub added the * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) label Aug 26, 2019
@davidfowl
Copy link
Member

Gonna close @benaadams

@davidfowl davidfowl closed this Oct 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.IO.Pipelines * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

StreamPipeReader does not amortize ValueTask ReadAsync calls
8 participants