5 ms·
Right, so it's less efficient than async. Async would let you yield at the gather.
by mrfox321 3y ago
Right, so it's less efficient than async.
Async would let you yield at the gather.
- flohofwoe 3y agoThe wait_all() "yields" to the operating system's thread scheduler, which switches to another thread that's ready to run (or if fibers are used instead of threads, a 'fiber scheduler' would switch to a different fiber within the same thread). Taking into account that an async/await runtime also needs to switch to a different "context", the performance difference really shouldn't be all that big, especially if the task scheduler uses fibers (YMMV of course).