CppCon 2021 has ended
Back To Schedule
Monday, October 25 • 12:30pm - 1:30pm
Automatically Process Your Operations in Bulk With Coroutines

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Feedback form is now closed.
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++.

ALL TALK SESSIONS CAN BE ACCESSED FROM THE MAIN LOBBY: https://cppcon.digital-medium.co.uk/

avatar for Francesco Zoffoli

Francesco Zoffoli

Software Engineer, Facebook
Francesco Zoffoli is a professional Software Engineer currently working for Facebook, building monitoring systems. Author of the book "C++ Fundamentals", passionate about programming languages and maintainable software, he has been using C++ throughout his career and personal projects... Read More →

Monday October 25, 2021 12:30pm - 1:30pm MDT