Back-end parallelism in the Rust compiler
The article discusses the implementation of back-end parallelism in the Rust compiler, specifically focusing on codegen units (CGUs). The Rust compiler compiles Rust code into a representation called MIR, which is then converted into LLVM IR and passed to LLVM for code generation. LLVM can process multiple chunks of LLVM IR in parallel, known as codegen units, to speed up compilation. In non-incremental builds, rustc splits the code into up to 16 CGUs. The article provides a visual representation of the execution timeline, highlighting the parallel execution of the LLVM threads. It also compares the performance of parallel execution with a single CGU, showcasing the benefits of parallelism. This article is relevant for developers who want to understand the performance optimizations in the Rust compiler and leverage parallelism for faster compilation.