File:Making a Rust crate compile faster.webm
Summary
Description |
English: In this stream, we try to figured out why the `cargo` crate takes so long to build. We don't ultimately make a meaningful improvement, but we do explore the many tools that exist to help with both analysis and remediation, and the value (and shortcomings) of each one.
Why is my Rust build so slow? https://fasterthanli.me/articles/why-is-my-rust-build-so-slow -Zsparse-registry https://blog.rust-lang.org/2022/06/22/sparse-registry-testing.html cargo --timings https://blog.rust-lang.org/2022/04/07/Rust-1.60.0.html#cargo---timings mold https://github.com/rui314/mold -Zshare-generics https://github.com/rust-lang/rust/blob/1f34da9ec8a85b6f86c5fa1c121ab6f88f2f4966/compiler/rustc_middle/src/ty/instance.rs#L112 cargo-bloat https://github.com/RazrFalcon/cargo-bloat Non-generic inner functions. https://www.possiblerust.com/pattern/non-generic-inner-functions cargo-llvm-lines https://github.com/dtolnay/cargo-llvm-lines -Zsymbol-mangling=v0 https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html -Zself-profile https://rust-lang.github.io/compiler-team/working-groups/self-profile/ crox https://github.com/rust-lang/measureme/blob/master/crox/README.md miniserde https://github.com/dtolnay/miniserde watt https://github.com/dtolnay/watt Where rustc spends its time. https://wiki.alopex.li/WhereRustcSpendsItsTime 0:00:00 Introduction 0:02:27 Setting up a test project 0:08:25 cargo build --timings 0:16:45 Linking 0:29:30 cargo bloat 0:40:50 -Zshare-generics 0:47:00 cargo-llvm-lines 1:24:56 rustc -Zself-profile 2:04:36 perf record rustc 2:13:10 miniserde 2:16:35 watt 2:25:00 Conclusion 2:25:40 Q&A 2:26:58 Overhead of monomorphization 2:27:51 Rust build time in 2-3 years 2:30:04 Do this again with new tools? 2:30:59 Breaking Cargo into subcrates 2:32:20 Is --release time important? 2:32:56 Automatic inner functions 2:34:46 Rust build time and adoption 2:37:00 Proc macro build time 2:41:25 Feature creep in Rust 2:43:05 Outroduction Live version with chat: https://www.youtube.com/watch?v=vxB4R2Guwp8 |
Date | |
Source | YouTube: Making a Rust crate compile faster – View/save archived versions on archive.org and archive.todayCategory:Media from YouTube |
Author | Jon Gjengset |
Licensing

- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
![]() |
This file, which was originally posted to an external website, has not yet been reviewed by an administrator or reviewer to confirm that the above license is valid. See Category:License review needed for further instructions. |