You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Throwing and catching an exception isn't the cheapest of operations; which has been mentioned as a separate issue #12892 (comment)
However the way async propagates a thrown exception (or cancellation, which is via exceptions), is a chain of try/catch/throws; so the cost of an exception is multiplied by the number of awaits in the chain.
Could the propagation of exceptions in the common pattern of a chain of await -> await -> await be more efficient (avoiding the rethrow and catch step) to reduce this multiplication factor?
I'm mostly thinking for the simpler case where they flow directly(ish) into the next Task and then also fault or cancel that.
e.g. have the exception passed through the awaiter/asyncmethodbuilder mechanism and stamped with the next bit of stack rather than invoking the full exception handling machinery
The text was updated successfully, but these errors were encountered:
Throwing and catching an exception isn't the cheapest of operations; which has been mentioned as a separate issue #12892 (comment)
However the way async propagates a thrown exception (or cancellation, which is via exceptions), is a chain of try/catch/throws; so the cost of an exception is multiplied by the number of
await
s in the chain.Could the propagation of exceptions in the common pattern of a chain of await -> await -> await be more efficient (avoiding the rethrow and catch step) to reduce this multiplication factor?
I'm mostly thinking for the simpler case where they flow directly(ish) into the next Task and then also fault or cancel that.
e.g. have the exception passed through the awaiter/asyncmethodbuilder mechanism and stamped with the next bit of stack rather than invoking the full exception handling machinery
The text was updated successfully, but these errors were encountered: