-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Consider using ValueTask<T> instead of Task<T> #33804
Comments
Estimates:
|
The problem with |
@weitzhandler If the only thing you're concerned with is not having to write unnecessary type arguments, then dotnet/csharplang#1349 has you covered. |
@terrajobst can you please expand on this? What do you mean by "entirely cached"?
Do you mean the analyzer should only flag cases where the For example, if you have: private Task<MyType> MyMethodAsync() { ... } Do you mean the analyzer should only suggest changing to MyType myType = await MyMethodAsync(); But if the analyzer finds at least one invocation that looks like this, then we don't suggest changing to Task<MyType> myTask = MyMethodAsync();
await myTask; |
Generally seems good as proposed. A few notes from the discussion
Category: Performance |
Flag
internal
/private
methods that returnsT
s that won't be entirely cached (e.g. bool) and where every caller of the method only ever awaits its result directly.Category: Performance
The text was updated successfully, but these errors were encountered: