4 ms·
The only yield points are .await points. If there's an .await in a loop, then sure, but otherwise no.
by steveklabnik 7y ago
The only yield points are .await points. If there's an .await in a loop, then sure, but otherwise no.
- amelius 7y agoWhat is the cost of an .await point? For this to work, perhaps Rust should cooperate too, inserting .await points at strategic places in the code, to keep cost low but still guaranteeing a certain responsiveness of the overall system.
- jfkebwjsbx 7y agoThat would explode the state machine size and make its performance characterization very hard. And you would need to avoid having any kind of call to external code (or yield before and after every such call, and pray for the best).
- deleted 7y ago[deleted]
- mwcampbell 7y agoIf I understand the futures::pending!() macro correctly, one can use that to add a forced yield point in a loop, right?
- steveklabnik 7y agoYes, it creates a future, and then immediately .awaits it.