rivet-gg / rivet

🔩 The only backend your multiplayer game needs. Open-source & self-hostable.
https://rivet.gg
Apache License 2.0
2.05k stars 47 forks source link

Assess Cranelift as development compiler backend #558

Closed AngelOnFira closed 3 weeks ago

AngelOnFira commented 7 months ago

It might be worth looking at using the Cranelift backend as the default (or opt-in) backend for development on the core repo. It would allow for faster debug builds, but wouldn't replace prod builds. I saw somewhere this morning that runtime performance is \~14% slower than the LLVM backend, which I imagine is alright for dev stuff.

LLVM backend clean compilation:

image.png

Cranelift backend clean compilation:

image.png

LLVM backend incremental compilation:

image.png

Cranelift backend incremental compilation:

image.png

One potential blocker is that Cranelift doesn't work on all platforms yet. For developing on Linux, it's fine (so Codespaces will work), but Apple Silicon (including devcontainers) wouldn't work. Bolt might be able to see this ahead of time and opt out of using Cranelift if the platform isn't installed.

https://github.com/rust-lang/rustc_codegen_cranelift?tab=readme-ov-file#platform-support

image.png

Current steps I see:

linear[bot] commented 7 months ago

RVT-3687 Assess Cranelift as development compiler backend