A zero-cost abstraction lets you write high-level Rust that compiles to optimized machine code without runtime overhead beyond an equivalent low-level implementation. Rust delegates much of its machine-code optimization to LLVM. section 11.1 section 11.0
Zero-cost does not mean every feature is free. Rust lets you introduce runtime overhead explicitly, such as dynamic dispatch through a trait object. That choice makes the cost easier to reason about. section 11.1
Trait objects and dispatch cost
A value stored as `Box<dyn MyTrait>` can call `MyTrait` methods through a vtable lookup. Similar virtual-method lookup costs can become significant in a tight loop over many elements. section 11.1
Compile in release mode to take advantage of optimizations. When performance needs closer attention, investigate the specific costs rather than assuming that every abstraction or dispatch choice is free. section 11.7 section 11.0
