
The State Machine Your async Method Compiles Into
An async method that never suspends allocates nothing. The same method, suspended once, allocates 160 bytes. The cost is not the keyword — it is the suspension.
Callum Reeve
C#, .NET, and the runtime beneath them: long-form technical writing about the CLR, the JIT, the garbage collector and the frameworks built on top.

An async method that never suspends allocates nothing. The same method, suspended once, allocates 160 bytes. The cost is not the keyword — it is the suspension.

Server GC finished 2.7 times faster and collected 17 times less often — and made the slowest request in the run 5 to 13 times slower. Both numbers are real.

Blocking on a task is the case the thread pool compensates for. Blocking on a sleep or an event is the case it cannot see, and it finished 2.5 times slower.