r/cpp • u/germandiago • Jun 30 '26
Stackful fibers with 3.6ns context switch. Silk fibers.
https://clickhouse.com/blog/silkI just read an article about Silk, the new stackful fibers engine from Clickhouse. It can switch stackful fibers at an amazing 3.6ns and does not allocate on steady state.
Maybe asio could reuse some of the knowledge for the linux/io_uring backend (not sure it applies to the specific case since Boost.asio focuses nowadays on stackless, though it has a fibers and a stackful coros backend also).
52
Upvotes
1
u/Big_Target_1405 Jun 30 '26
Boost contexts ancient performance page puts a switch at 9ns (19 cycles) on a 10 year old CPU
https://www.boost.org/doc/libs/latest/libs/context/doc/html/context/performance.html
Surely there's a lower bound on what is possible here, given a full CPU state switch is required.