14 Oct
2017
14 Oct
'17
6:04 p.m.
Seth wrote:
coroutines are not zero cost
In some cases they can have negative cost. See Gor Nishanov's CppCon 2015 presentation, "C++ Coroutines - a negative overhead abstraction". With coroutines, the state is essentially a program counter value which can be saved and restored with similar cost to a function call or return. When the alternative is something like a state enum and a switch statement, the coroutine is going to win. Regards, Phil.