What is the cost of async in Rust

Rust's async/await has zero runtime overhead for the abstraction itself, relying on the chosen runtime for actual performance characteristics.

The cost of async in Rust is zero at runtime for the abstraction itself, as Rust uses zero-cost abstractions where higher-level features compile to code as fast as manual implementations. The actual performance depends on the runtime (like tokio or async-std) and how you structure your tasks, not the async/await keywords.

use tokio;

#[tokio::main]
async fn main() {
    // This async function compiles to a state machine
    // with no overhead compared to manual callback code
    println!("Hello async!");
}