Re:My tutorial and take on C++20 coroutines
by BenFrantzDale on Monday February 22, 2021 @03:23PM
(#26230043)
It's a big deal because, while it has some downsides, being stalkless means they can have next to no overhead, meaning it can be performant to use coroutines to write asynchronous code for even very fast operations. The example given https://www.youtube.com/watch?v=j9tlJAqMV7U&t=13m30s is that you can launch multiple coroutines to issue prefetch instructions and process the fetched data, so you can have clean code that issues multiple prefetches and process the results. Whereas in Python (don't get me wrong, I love Python) you might use a generator to "asynchronize" slow operations like requesting and processing data from remote servers, C++ coroutines can be fast enough to asynchronously process "slow" operations like requesting data from main memory.
Re:My tutorial and take on C++20 coroutines
by mazieres on Monday February 22, 2021 @09:15PM
(#26233139)
Wow, that talk is a fantastic link. He actually gets negative overhead from using coroutines, because the compiler has more freedom to optimize when humans don't prematurely break the logic into multiple functions.
Re:My tutorial and take on C++20 coroutines
by gpderetta on Monday February 22, 2021 @02:40PM
(#26229450)
All those languages have also stackless coroutines. Notably Lua and Go have stackful coroutines.
It is sort of a big deal because the discussion of wether adding stackful or stackless coroutines in C++ was an interminable and very visible one. Stackless won.
Why is this a big deal in C++? Am I missing anything that makes c++ coroutines less powerful than other mainstream solutions? Or are people comparing its power with e.g. Lisp or go?