Native Code
Rust is compiled to target CPU code via LLVM. So you get similar speeds to C/C++.
- In more detail, Rust has good CPU performance because of how it is compiled.
- C, C++, Rust, Swift, and Julia, compile to something called LLVM IR -- which is short for low level virtual machine, intermediate representation.
- This is further compiled into CPU specific instructions,
- meaning it runs very fast, on those CPUs,
- whether it is Intel, ARM -- which is what Macs use, or something else.
- This means you cannot take an executable compiled for Intel, and run it on an ARM CPU.
- LLVM IR can also be compiled to Web assembly, which runs in the browser.