Skip to content

TKONIY/co-benchmark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coroutines Benchmark

I'm not going to argue with anyone about the fucking confusing concepts of thread, coroutine and fiber. I call them all coroutines. They can be classified by stack, scheduler or threads.

TODO

  • Rewrite CMakeLists.txt to find brpc in system library.
  • Design benchmark for stackful and stackless seperately.

Benchmarks

Common Benchmarks

pthread bthread libco cpp20co libgo
create
join 🈚️ 🈚️
resume 🈚️ 🈚️ 🈚️
multiply 1
multiply 1M
ctx switch single-thread
ctx switch multi-thread 🈚️ 🈚️

Library Specific Benchmarks

Start Urgent Test

  • bthread: bthread_start_urgent
  • libgo: go and yield

Getting Start

⚠️ Since I haven't figured out how to write the CMakeLists.txt for projects with brpc, current build configurations of this project are taken from incubator-brpc/example/echo_c++. Thus this project can only be place on the same dir. This will be fix as soon as possible.

⚠️ Different benchmarks can be switched by modifying main() in benchmark.cpp. Command line support will be added soon.

  1. Install all libraries into default system path except brpc. CMake looks up the libraries in default path.
  2. Clone and compile brpc according to official tutorial.
  3. Clone this project into brpc's example dir.
    cd incubator-brpc/example
    git clone git@github.com:TKONIY/ThreadBenchmark.git
  4. Modify main() in benchmark.cpp. One benchmark of all libraries will be provided in one build.
  5. Build the project.
cd ThreadBenchmark
mkdir build
cd build
cmake ..
cmake --build .
  1. All executable will be provided in build/ like this:
build
  ├── benchmark_bthread
  ├── benchmark_cpp20co
  ├── benchmark_libco
  ├── benchmark_libgo
  └── benchmark_pthread
  1. Just simply execute the binary files.
./benchmark_cpp20co

Releases

No releases published

Packages

No packages published