rustc_codegen_cranelift is available on nightly! (
from to on 31 Oct 2023 12:26 +0000

Quite some exciting progress since the last progress report! There have been 180 commits since the last progress report.

As of today, rustc_codegen_cranelift is available on nightly! :tada: You can run rustup component add rustc-codegen-cranelift-preview --toolchain nightly to install it and then either CARGO_PROFILE_DEV_CODEGEN_BACKEND=cranelift cargo +nightly build to use it for the current invocation or add

#rust on 31 Oct 2023 14:53 +0000 next

Really exciting news! This should mitigate a longstanding problem that Rust developers have had when iterating. on 01 Nov 2023 03:13 +0000

Trying cranelift for the first time (I think).

Let’s create a “release-dev-cl” profile that inherits “release-dev” profile and compare.

For reference, “release-dev” is:

inherits = "release"
debug = "full"
codegen-units = 8
lto = "off"

Cool, cold builds (including deps) went from 73s to 37s, with zstd-sys becoming a bigger offender.

But but but…

warning: unsupported x86 llvm intrinsic llvm.x86.aesni.aesimc; replacing with trap
warning: unsupported x86 llvm intrinsic llvm.x86.aesni.aesdec; replacing with trap
warning: unsupported x86 llvm intrinsic llvm.x86.aesni.aesdeclast; replacing with trap

Alright. Which dep is using this. Let’s cargo vendor and rg.

% cargo vendor &>/dev/null
% cd vendor
% rg -l 'aesimc|aesdec|aesdeclast' | sed 's|/.*||' | sort -u


Alright, let’s try another project…

Nice, this one goes from 52s to 19s, and no unsupported intrinsics.

Let’s test the binary.

Hmm, it’s orders of magnitude slower… let’s perf

  • LLVM
   1.71%  async-global-ex  abcd-cli              [.] alloc::collections::btree::map::IntoIterᐸK,V,Aᐳ::dying_next                                   
   1.66%  async-global-ex  abcd-cli              [.] ᐸalloc::collections::btree::map::KeysᐸK,Vᐳ as core::iter::traits::iterator::Iteratorᐳ::next   
   1.53%  async-global-ex             [.] 0x0000000000158c4a                                                                            
   1.48%  blocking-4       abcd-cli              [.] ᐸlz4_flex::frame::decompress::FrameDecoderᐸRᐳ as std::io::Readᐳ::read_to_end                  
   1.35%  async-global-ex             [.] 0x000000000015818d                                                                            
   1.28%  blocking-1       abcd-cli              [.] ᐸlz4_flex::frame::decompress::FrameDecoderᐸRᐳ as std::io::Readᐳ::read_to_end                  
   1.25%  blocking-4       abcd-cli              [.] ᐸcore::iter::adapters::map::MapᐸI,Fᐳ as core::iter::traits::iterator::Iteratorᐳ::try_fold     
   1.25%  async-global-ex             [.] malloc                                                                                        
   1.19%  blocking-4             [.] malloc                                                                                        
   1.12%  blocking-2       abcd-cli              [.] ᐸlz4_flex::frame::decompress::FrameDecoderᐸRᐳ as std::io::Readᐳ::read_to_end                  
   1.06%  async-global-ex             [.] 0x0000000000158487                                                                            
   0.99%  async-global-ex  abcd-cli              [.] ᐸalloc::collections::btree::map::BTreeMapᐸK,V,Aᐳ as core::ops::drop::Dropᐳ::drop              
   0.92%  blocking-2             [.] malloc                                                                                        
   0.91%  blocking-4             [.] 0x0000000000158180                                                                            
   0.85%  blocking-2       [kernel.vmlinux]      [k] clear_page_erms                                                                               
   0.84%  async-global-ex  abcd-cli              [.] alloc::collections::btree::search::ᐸimpl alloc::collections::btree::node::NodeRefᐸBorrowType, 
   0.81%  async-global-ex  abcd-cli              [.] abcd::all::ELSMap::mk_extr on 03 Nov 2023 16:15 +0000

That’s a hell of a comment !