DEV Community

Discussion on: Performance Comparison, Rust vs Crystal with Redis

tamas profile image
Tamás Szelei

LTO stands for link-time optimization, which is a great feature of LLVM (thus, rustc). You can enable it in your Cargo.toml:

lto = true

The above will make --release builds use "fat" LTO, meaning all dependencies and the project itself is link-time optimized (you could set it to "thin" which means LTO is only applied to the current crate).

Another option to go even further is PGO, but that is a bit more involved and I haven't tried it with rust. Here is some documentation if you are interested:

Combining both can go pretty far in optimizing performance.