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

Conversation

@benaadams
Copy link
Member

Use cached tasks for both Task.FromResult and AsyncTaskMethodBuilder rather than just AsyncTaskMethodBuilder

  • Move GetTaskForResult from AsyncMethodBuilder to Task<TResult>
  • Move AsyncTaskCache from AsyncMethodBuilder to future.cs
  • Call Task<TResult>.GetTaskForResult(result) from FromResult rather than creating new Task
  • Call Task.FromResult<TResult>(result) from AsyncTaskMethodBuilder rather than GetTaskForResult(result)

/cc @stephentoub

Resolves #5185

Use cached tasks for both FromResult and AsyncTaskMethodBuilder rather
than just AsyncTaskMethodBuilder

Move GetTaskForResult from AsyncMethodBuilder to Task<TResult>
Move AsyncTaskCache from AsyncMethodBuilder to future
Call Task<TResult>.GetTaskForResult(result) from FromResult rather than
creating new Task
Call Task.FromResult<TResult>(result) from AsyncTaskMethodBuilder rather
than GetTaskForResult(result)
@davidfowl
Copy link
Member

davidfowl commented May 24, 2016

Fast on .NET Core, slow on .NET Framework? Or will be port this? Isn't this a breaking change at this point?

@benaadams
Copy link
Member Author

benaadams commented May 24, 2016

@benaadams
Copy link
Member Author

Likely a moot change anyway with arbitrary async returns dotnet/roslyn#10902

@benaadams benaadams closed this May 24, 2016
@benaadams benaadams deleted the prealloc-tasks-in-fromresult branch September 8, 2016 07:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants