Comment

Comment by joaquintides

Vinnie Falco, creator of Boost.Beast, shares the origin story behind two new coroutine-based networking libraries, Corosio and Capy. While designing Beast2 as a C++11 networking library, Falco repeatedly sought design advice from Peter Dimov, who had one persistent answer: just use coroutines. Determined to prove him wrong, Falco set out to learn coroutines, implement his own task type, and benchmark it against ASIO.

The results surprised him. Initial benchmarks confirmed his suspicion that coroutines performed poorly, but after applying optimizations like a recycling allocator, performance improved dramatically. Under more realistic, higher-abstraction scenarios, coroutines actually beat ASIO - because composed operations built from nested operation states accumulate costly move constructions and memory copies as structs grow, while a coroutine handle remains just a pointer. What began as a mission to discredit coroutines became the foundation for two new libraries.

https://github.com/cppalliance/corosio https://github.com/cppalliance/capy

parent joaquintides 8 months ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton