Library for await and stackless coroutine emulation
Hi there, I just want to announce my recent work on a small library called `CO2`, which intend to emulate await/yield and stackless coroutine. https://github.com/jamboree/co2 This library depends on Boost.Preprocessor, while I'm not proposing this library to Boost at this moment, if there's much interest in this library, I'd think about it. The idea is based on N4286: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4286.pdf The library is still work in progress, but the core features are complete, so if you're interested in the resumable function proposal and don't have a tool to experiment with, this library may serve the purpose. You can find a more detailed description on the github page, if you want to know some number about performance, from a rough test borrowed from Boost.Coroutine (symmetric/performance_switch.cpp), the avg cpu cycles for context-switch are: Boost.Coroutine: 40 cycles CO2: 16 cycles built-in await: 9 cycles (compiled with MSVC14, x64) Feedbacks will be appreciated. Thanks
On 03/05/2015 04:32 PM, TONGARI J wrote:
You can find a more detailed description on the github page, if you want to know some number about performance, from a rough test borrowed from Boost.Coroutine (symmetric/performance_switch.cpp), the avg cpu cycles for context-switch are:
Boost.Coroutine: 40 cycles CO2: 16 cycles built-in await: 9 cycles
I am curious about the performance difference. How much context does CO2 preserve during a context-switch?
2015-03-10 1:10 GMT+08:00 Bjorn Reese
On 03/05/2015 04:32 PM, TONGARI J wrote:
You can find a more detailed description on the github page, if you want
to know some number about performance, from a rough test borrowed from Boost.Coroutine (symmetric/performance_switch.cpp), the avg cpu cycles for context-switch are:
Boost.Coroutine: 40 cycles CO2: 16 cycles built-in await: 9 cycles
I am curious about the performance difference. How much context does CO2 preserve during a context-switch?
Only one `unsigned` for jumping(switch). After some tuning, the context-switch is somehow faster than MSVC's __await. CO2: 7 cycles; __await: 11 cycles.
participants (2)
-
Bjorn Reese
-
TONGARI J