Why is the Rust Compiler So SLOW?

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

A deep dive into why Rust compilation is slow, particularly in Docker environments. The investigation reveals that LLVM optimizations, especially link-time optimization (LTO) and function inlining, consume most compilation time. Through profiling tools and trace analysis, the author discovers that async functions and closures significantly impact build times due to their complex state machine implementations. Various optimization strategies are explored, including reducing LLVM inlining thresholds, breaking up large async functions, enabling shared generics, and switching from Alpine to Debian base images, ultimately reducing build times from 175 seconds to under 10 seconds.

57m watch time
2 Comments

Sort: