Get the latest tech news
Async2 – The .NET Runtime Async experiment concludes
The .NET team has been working on a new experiment called async2, which is a new implementation of the async/await pattern that is designed to be more efficient and more flexible than the current implementation. It started with green threads and ended with an experiment that moves async and await to the runtime. This post will cover the journey of async2 and the conclusion of the experiment.
If that thing ever makes it into the runtime, it will be called async- so it will be a replacement for the current async implementation. async2 would not have save or restore of SynchronizationContext and ExecutionContext at function boundaries, instead allowing callers to observe changes. Feature asyncasync2 PerformanceGenerally slower than async2, especially for deep call stacksGenerally faster than async, with performance comparable to synchronous code in non-suspended scenariosException HandlingSlow and inefficient, causing GC pauses and impacting responsive performance of applicationsImproved EH handling, reducing the impact on application responsivenessStack Depth LimitationLimited by stack depth, which can cause issues for deep call stacksNo explicit limitations on stack depth, allowing async2 to handle deeper call stacks more efficientlyMemory ConsumptionGenerally lower than async2, especially in scenarios with many suspended tasksHigher memory consumption due to capturing entire stack frames and registers, but still acceptable compared to other factors like pause times As the name suggests, this is just an experiment, that may lead to a replacement of async in some years.
Or read this on Hacker News