Does cranelift have any rust frontends with enabled compiler optimizations? I found only this one https://github.com/bjorn3/rustc_codegen_cranelift but, as I understand it supports only debug mode.
Maybe some community ones?
:wave: Hey, As far as I understand cg_clif should support release mode, did you find any issue with it?
Oh, it really works, sorry for that
As a follow up here, we ran a few benchmarks comparing the execution performance of Rust code compiled with rustc_codegen_cranelift
in release mode vs using rustc
to compile to WASM target and then using wasmtime
to execute that WASM and we're seeing >20x difference on benchmark that computes number pi
.
Is this expected? What could explain such massive difference in performance?
You can find the exact steps we took in the benchmark here
as well as full comparison table and the code of the benchmark
My guess as to what you're seeing is the difference that an optimizing compiler makes. Cranelift doesn't perform the same degree of optimization that LLVM does, so by taking it out of the picture you're missing out on things like inlining for example.
Last updated: Dec 23 2024 at 12:05 UTC