Inline In Rust
There's a lot of tribal knowledge surrounding #[inline] attribute in Rust. I often find myself teaching how it works, so I finally decided to write this down.
There’s a lot of tribal knowledge surrounding #[inline] attribute in Rust. I often find myself teaching how it works, so I finally decided to write this down. Caveat Emptor: this is what I know, not necessarily what is true. Additionally, exact semantics of #[inline] is not set in stone and may change in future Rust versions. Why Inlining Matters? Inlining is an optimizing transformation which replaces a call to a function with its body. To give a trivial example, during compilation the compiler can transform this code: fn f (w: u32 ) -> u32 { inline_me (w, 2 ) } fn inline_me (x: u32 , y: u32
related reading
- A half-hour to learn Rustfasterthanli.me
- How to use storytelling to fit inline assembly into Rustralfj.de
- Compilers - What Every Programmer Should Know About Compiler Optimizations | Microsoft Learnlearn.microsoft.com
- Rust Optimization.md · GitHubgist.github.com
- Rewriting Bun in Rust | Bun Blogbun.com
- Everyone Says Assembly Is Untyped—Everyone Is Wronggingerbill.org
- Rust Language Cheat Sheetcheats.rs
- Learn Rust the Dangerous Waycliffle.com
- LLVM is Smarter Than Meblog.sulami.xyz
- Modules and crates - Rust for C-Programmersrust-for-c-programmers.com
- A Gentle Introduction to LLVM IR · mcyoungmcyoung.xyz
- Measure What You Optimizecliffle.com