Allow coroutine resume functions with type
value_type (*_Resume_fn)(void )
The current resume function
void (*_Resume_fn)(void)
reduces performance for a significant subset of generators compared to macro based coroutines. We should allow resume functions to take advantage of fast register return conventions.
Create coroutine_handle_fast
It would use intrinsic
size_t _coro_resume_fast(_Ptr);
Code generation for _coro_resume_fast:
co_yield expr would no longer equate to co_await p.yield_value(x), but would suspend and return the value directly.
co_return or completing the coroutine would return p.sentinel_value();
for coroutines returning types larger than size_t, the return value would be a pointer with 0 for the sentinel.
Allow coroutine resume functions with type value_type (*_Resume_fn)(void ) The current resume function void (*_Resume_fn)(void) reduces performance for a significant subset of generators compared to macro based coroutines. We should allow resume functions to take advantage of fast register return conventions.
Create coroutine_handle_fast
It would use intrinsic
size_t _coro_resume_fast(_Ptr);
Code generation for _coro_resume_fast:
A benchmark that shows performance degradation compared to macro based coroutines is at https://gist.github.com/imoldfella/ea264e146df67884056da0af1e61964f