Giter VIP home page Giter VIP logo

couring's Introduction

couring

C++ program that uses C++20 Corotuines and io_uring. Implementation explained in the blog series

Requirements

You will need a Linux kernel version 5.1 or higher and have liburing installed. Your C++ compiler must support C++20 and coroutines.

Build

cmake -Bbuild -DCMAKE_BUILD_TYPE=Release
cmake --build build

Usage

Preparing the data

Download any OBJ file you want from the internet and put them in folder.

To make things interesting you'll need hundreds of them, you can duplicate a OBJ file switch with a bash one-liner

for i in {1..5000} do cp my_file.obj my_file_$1.obj done

Running

Once you have all obj files on disk you can invoke the tool by passing the directory containing them.

./build/couring /folder_containing_obj_files <implementation>

There are five different implementations of the algorithm:

--trivial: Single-threaded synchronous implementation

--thread-pool Multi-threaded synchronous implementation

--iouring Single-threaded asynchronous implementation using iouring

--coroutines asynchronous implementation with coroutines with iouring, parsing single-threaded

--coro-pool asynchronous implementation with coroutines with iouring, parsing multi-threaded

There is a convenience script that runs all implementations and times them:

> ./run_all build /folder_containing_obj_files
#########
Running trivial implementation
Processed 512 files.

real	0m0.419s
user	0m0.371s
sys	0m0.046s
#########
Running multi-threading implementation
Processed 512 files.

real	0m0.177s
user	0m0.599s
sys	0m0.026s
#########
Running iouring implementation
Processed 512 files.

real	0m0.368s
user	0m0.317s
sys	0m0.050s
#########
Running couroutines implementation
Processed 512 files.

real	0m0.339s
user	0m0.305s
sys	0m0.033s
#########
Running coroutines thread pool implementation
Processed 512 files.

real	0m0.230s
user	0m0.732s
sys	0m0.047s

couring's People

Contributors

pabloariasal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

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.