You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to have a deeper understanding of P2300, I have always wanted to know the similarities and differences with rust's zero-cost async abstrction, as well as the advantages and disadvantages.
Some similarities:
Rust also decouple async algorithm and execution context
The core of async in rust is also lazy future
Lazy future can be combined with async algorithms or awaited, which unifies future(sender) and coroutine.
Differencies I can think of:
Sometimes Rust async is not heapless like the design in P2300.
Maybe one advantage of Rust async:
poll based lazy future provides a normative interface, it's clear when implementing event based async operation like epoll/io_uring, the code is readable and different implementations are similar since the poll interface is directly related to the async operation progress. But it's more free in C++, where we need to define our own state machine and cooperate with the scheduling context in order to push the progress of the async operation. (forgive me to use libunifex as an example here https://github.com/facebookexperimental/libunifex/blob/main/include/unifex/linux/io_epoll_context.hpp#L372)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In order to have a deeper understanding of P2300, I have always wanted to know the similarities and differences with rust's zero-cost async abstrction, as well as the advantages and disadvantages.
Some similarities:
Differencies I can think of:
Maybe one advantage of Rust async:
poll
based lazy future provides a normative interface, it's clear when implementing event based async operation like epoll/io_uring, the code is readable and different implementations are similar since thepoll
interface is directly related to the async operation progress. But it's more free in C++, where we need to define our own state machine and cooperate with the scheduling context in order to push the progress of the async operation. (forgive me to use libunifex as an example here https://github.com/facebookexperimental/libunifex/blob/main/include/unifex/linux/io_epoll_context.hpp#L372)Beta Was this translation helpful? Give feedback.
All reactions