Stream: t-compiler/help

Topic: MIR and await/async


xd009642 (Aug 07 2020 at 17:29, on Zulip):

So it's recommended that in async you don't block the scheduler because then your futures won't be polled and in tokio (at least) you should use spawn_blocking for computationally intensive code. And a vague rule of thumb I was told in the tokio discord is anything over 10ms should be in a spawn_blocking.

So I was thinking of trying to identify the largest set of statements between await calls in a single thread and whether I could use MIR to do that analysis? I have a feeling the async await stuff might have been reduced to statemachines at this point so I'm possibly barking up the wrong tree.

bjorn3 (Aug 07 2020 at 17:33, on Zulip):

async await gets turned into state machines by a mir pass: https://github.com/rust-lang/rust/blob/4d4342347b71313258a46e506ee0a258f365185c/src/librustc_mir/transform/mod.rs#L438

Last update: Sep 27 2020 at 14:30UTC