4 ms·
> Having a sync interface would make it easy to use in sync code, yes. I feel that we are far from zero cost abstractions now, though. Why do you say that? Tak
by eridius 10y ago
> Having a sync interface would make it easy to use in sync code, yes. I feel that we are far from zero cost abstractions now, though.
Why do you say that? Taking an async zero-cost-abstraction API and calling wait() on it doesn't magically make it more expensive. It just blocks the current thread until the async operation is done. Said operation is just as fast and zero-cost as it was before.
- fooyc 10y agoYou had a call to read(). Now you have a thread, an event loop, a pooling mechanism, and a synchronization with the thread. That's much more system calls and cpu cycles.
- eridius 10y agoIf you're just talking about a call to read(), that would be modeled by a Future, not a tokio reactor.
- fooyc 10y agoCan you explain how you can make a blocking call to an async function without overhead ?
- eridius 10y agoIf you accept that using the async call in an asynchronous nature doesn't have overhead, then you can turn it into a synchronous call by saying something like `.wait()`.
- fooyc 10y ago> If you accept that using the async call in an asynchronous nature doesn't have overhead Obviously that's not the case. There is a lot of overhead.