How to get blazingly fast rust builds.

A few years ago I built [](). The goal was to speed up rust builds by at least \~3-5x. I had multiple huge rust projects and compilation was taking time (3-4 minutes). This was an issue. The goal of this article is to explain how you can speed up your rust builds and explain the common pitfalls. We will be using the [alacritty]( repository. Keep in mind I am running an M1 Max (32GB RAM) MacOS Sonoma setup. However, the steps must be identical to Windows/Linux. First things first you can clone the repository: ```bash git clone ``` We will first start with understanding the build waterfall ```bash cargo build --timings ``` It takes around 13.1s let us see if we can start optimizing that! ## What is increasing build times - Macros - A codegen step has to happen which is quite expensive - Monomorphization - This means that the compiler stamps out a different copy of the code of a generic function for each concrete type needed. For example, if I use a `Vec<u64>` and a `Vec<String>…
Related Topics: Rust