Rust Lands Experimental Cranelift-Based Code Generator - Much Faster Debug Build Times

Written by Michael Larabel in Programming on 27 October 2020 at 01:54 PM EDT. 7 Comments
PROGRAMMING
Landing yesterday within the Rust code-base is the initial version of a Cranelift code generator back-end. By leveraging the Cranelift code generator that is developed as part of the Bytecode Alliance for WebAssembly, Rustc with Cranelift can experince much faster debug builds.

The pull request adding rustc_codegen_cranelift as an alternative code generator for the Rust compiler has been merged. When compiling Rust code with the debug mode set, this has the potential of speeding up compile times by 20~30% compared to the debug mode LLVM builds.

Cranelift is the code generator taking target-independent IR and translating into executable machine code. Cranelift is principally focused on WebAssembly but has seen interest elsewhere. Cranelift so far is principally focused on x86_64 support with other CPU architectures at various stages of support. Cranelift has also been explored as a possible back-end for the IonMonkey JavaScript compiler within Firefox and for WebAssembly with Firefox's SpiderMonkey engine.

The non-default, experimental Cranelift back-end for Rust is now merged. The rustc_codegen_cranelift repository also saw its initial version (v0.1.0) to mark the milestone. At this point its primary benefit seems to be over faster debug build times but not for release builds or the resulting binary performance, but we'll see in time as Cranelift matures and is supported more broadly how well it continues performing.

This Cranelift documentation provides a comparison how they view themselves compared to LLVM.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week