Eliding Async and Await

Being able to elide Async and Await can provide application efficiency benefits that at first may seem minimal but in the big picture will result in the compiler being able to skip the generation of the async state machine and result in fewer compiler generated types in the assembly as well as fewer items added to the GC and CPU computations.

When a async state machine is generated for a single await, you can effectively get a few extra IL instructions created as a result. In my opinion it is a benefit to elide await where possible but in some cases it isnt such as using statements.

Async does have great benefits such as performing code executions in parallel requests but it does however perform in a much more inefficient way than using synchronous code. Adding more awaits and async’s to an application ends up multiplying the cost at each point.

You can read more about it here:-

https://blog.stephencleary.com/2016/12/eliding-async-await.html

Add comment

Loading