Header Image

Automatically Process Your Operations in Bulk With Coroutines

Performing bulk operations is more efficient than performing multiple single operations in many scenarios: memory allocations, I/O, IPC, etc.
At the same time, code that performs operations in bulk requires extra bookkeeping and boilerplate compared to equivalent code which operates on each individual item.
In this talk, we’ll see how C++20 coroutines let us get the performance gains of executing operations in bulk, without the maintenance burden.

Often it’s easier to write code that executes on an item at a time rather than on multiple items: it’s easier to write an if condition than to call std::erase_if, it’s easier to call a function than calling std::transform.
When operating on an item at a time, it is also possible to use exceptions for error handling.
Once we change our code to operate on batches of items, the logic often looks completely different from the original one.

Could we keep our code as if we were processing an item at a time, but calling functions on multiple items behind the scenes?
What if we could aggregate all the arguments to a function into a collection, execute the function with the collection of arguments, and redistribute the results to each caller in a completely transparent way?

This talk will show how such a system could be implemented using coroutines.
It will show step by step how to implement a task and awaitable object which can suspend a function in a synchronous context and resume it once the underlying bulk operation has completed, and how to schedule such tasks.

Have you heard of coroutines but haven’t seen an application of them yet?
Did you read about all the new customization points introduced but haven’t still realized how to make use of them?
Are you looking for a practical and interesting use case for coroutines?
This talk is for you!

Join us to learn about a new way of creating powerful abstractions in modern C++.

May 24 @ 13:00
13:00 — 13:45 (45′)


Francesco Zoffoli

Register Now

× How can I help you?