Files
dotnet-runtime/src/libraries/System.Net.Http
Stephen Toub 4013121804 Avoid Task allocation for CreateContentReadStreamAsync
Most HttpContents produce the Stream from CreateContentReadStreamAsync synchronously, which means CreateContentReadStreamAsync is allocating a Task to wrap that stream unnecessarily.  While we can't change the existing protected API to return ValueTask instead of Task, we can add an internal API that we use instead.  The new base virtual just delegates to the existing Task-based overload.  Then derived implementations can override this; such derived implementations can just do the more efficient thing if they're sealed, or if they're not sealed, do so when they're sure a derived type isn't overriding the delegated implementation, e.g. by checking the concrete type of the instance.


Commit migrated from https://github.com/dotnet/corefx/commit/01abf38cac641981db1cbbf74012ddbbf0d768df
2017-06-28 21:41:57 -04:00
..
2017-05-16 14:12:16 -07:00
2017-05-19 10:17:08 -07:00