Function call indirection in Rust async code is almost never a real performance concern. The Rust compiler in release mode frequently inlines extracted helper functions, producing identical assembly to inlined code. The actual costs worth worrying about are I/O, locks, and allocations — not function call boundaries, which cost only a few CPU cycles. Real indirection overhead only matters in tight inner loops, with dyn Trait dynamic dispatch, or in explicitly performance-critical paths. The post argues that premature inlining sacrifices code readability, testability, and maintainability for no measurable gain, and recommends using profilers like callgrind or perf to verify actual bottlenecks before optimizing. The right approach is to extract well-named functions, trust the optimizer, and only reach for #[inline] when profiler data justifies it.
1 Comment
Sort: