Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Building

Usually, building a Rust project is as simple as running the appropriate Cargo command, and everything just works:

cargo build --release

However, doing builds on a larger scale can present with some more challenges. For example, always building the same dependencies in CI can present some challenges. Some projects want to provide builds for multiple architectures.

This chapter discusses some issues you might run into when building Rust code in your project, and strategies for how you might solve that.

Reading

Matthias goes through and extensive list of tips for getting faster Rust compile times. These include making sure your toolchain is up-to-date, enabling the parallel compiler frontend, removing unused dependencies, debugging dependency compile times, splitting large crates into smaller ones, optimizing workspaces, compilation caching, and many more.

Fast Rust Builds (archived) by Alex Kladov

Alex explains some strategies to speed up Rust compilation. He explains that the Rust programming language has prioritized execution speed and programmer productivity over compilation speed. He gives recommendation for how to setup your CI pipeline, pruning dependencies, what code styles lead to faster compilation times.