Lightweight, portable C++ fibers, MIT license

后端 未结 6 618
迷失自我
迷失自我 2021-02-03 11:15

I would like to get ahold of a lightweight, portable fiber lib with MIT license (or looser). Boost.Coroutine does not qualify (not lightweight), neither do Portable Coroutine Li

6条回答
  •  梦谈多话
    2021-02-03 11:38

    There is a blazing fast and lightweight C asymmetric coroutine library - libaco.

    It is really small, very fast and extremely memory efficient:

    Along with the implementation of a production-ready C coroutine library, here is a detailed documentation about how to implement a fastest and correct coroutine library and also with a strict mathematical proof;

    It has no more than 700 LOC but has the full function you may want from a coroutine library;

    The benchmark part shows that one time of the context switching between coroutines only takes about 10 ns (for the case of standalone stack) on the AWS c5d.large machine;

    User could choose to create a new coroutine with a standalone stack or with a share stack (could be shared with others);

    It is extremely memory efficient: 10,000,000 amount of co simultaneously to run only cost 2.8 GB physical memory (run with tcmalloc, each co has a 120B copy-stack size configuration).

    It also has a very detailed documentation.

    PS:

    It is under the Apache License, Version 2.0.

提交回复
热议问题