Here are some tips to speed up your compile times. This list was originally released on my private blog, but I decided to update it for 2024 and move

Tips For Faster Rust Compile Times

submited by
Style Pass
2024-05-15 05:30:04

Here are some tips to speed up your compile times. This list was originally released on my private blog, but I decided to update it for 2024 and move it here.

Making the Rust compiler faster is an ongoing process. Thanks to their hard work, compiler speed has improved 30-40% across the board year-to-date, with some projects seeing up to 45%+ improvements. It pays off to keep your toolchain up-to-date.

Most of the time, you don't even have to compile your project at all; you just want to know if you messed up somewhere. Whenever you can, skip compilation altogether. What you need instead is laser-fast code linting, type- and borrow-checking.

Use cargo check instead of cargo build whenever possible. It will only check your code for errors, but not produce an executable binary.

Consider the differences in the number of instructions between cargo check on the left and cargo debug in the middle. (Pay attention to the different scales.)

Leave a Comment