Is Rust compiled or interpreted?
Rust is compiled ahead of time to machine code, through the LLVM compiler backend. It has no virtual machine and no garbage collector.
How it runs your code
The Rust compiler, rustc, checks ownership and borrowing rules, then LLVM turns the program into machine code. Debug builds use no optimization. Release builds, made with cargo build --release, use optimization level 3 by default. Miri, an interpreter for Rust, exists to detect undefined behavior, and nobody uses it to run production programs.
Does that make Rust slow?
Rust's speed comes from ahead-of-time optimization, like C++, and from having no garbage collector. A debug build can run far slower than a release build, so always time a release build.
Questions
Is Rust interpreted?
No. Rust is compiled ahead of time to machine code. Miri is an interpreter for checking programs, not for running them.
Does Rust have a garbage collector?
No. Rust frees memory through its ownership rules at compile time.
Why are Rust debug builds slow?
Debug builds turn optimization off. Release builds turn it on.
Related
Is C++ compiled? · Is Go compiled? · Is Swift compiled? · Compiled vs interpreted · Why optimization decides speed