Unlisted Videos All Videos All Videos Submit Video



Automatically Process Your Operations in Bulk With Coroutines - Francesco Zoffoli - CppCon 2021








Uploaded to YouTube by: CppCon
Date submitted to Unlisted Videos: 20 February 2024
Date uploaded/published to YouTube: 25 December 2021

Tags:




Description:

https://cppcon.org/
https://github.com/CppCon/CppCon2020
---
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++.

---
Francesco Zoffoli

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. C++ is his language of choice due to its expressivity, especially its metaprogramming capabilities.

---
Videos Recorded & Edited by Digital Medium: http://online.digital-medium.co.uk

Register Now For CppCon 2022: https://cppcon.org/registration/