Code Monkey home page Code Monkey logo

co-benchmark's Introduction

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 [email protected]: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

co-benchmark's People

Contributors

tkoniy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

ma1onezhang

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.