| 20 Mar 2026 |
emily | the Rust frames will look just like C++ ones as far as Boehm is concerned | 12:24:21 |
Sergei Zimmerman (xokdvium) | I mean if it just lives on the stack/registers/TLS it would just work, yes. | 12:24:43 |
piegames | Though still, manual rooting would be a "solution" for the rooting problem in Rust GC. Admittedly an unsafe one, but still an improvement over anything C++ | 12:25:34 |
emily | (that said the perf tradeoffs between sufficiently good refcounting and sufficiently good GC aren't necessarily obvious, though Nix has little use for latency over throughput and lacks complex finalizers so likely to tilt in the GC direction. OTOH memory usage is famously bad so eager collection might not be the worst thing...) | 12:25:49 |
emily | what do you mean by perf cost due to FFI linking? | 12:26:17 |
emily | manual rooting without an API that enforces it is vastly less safe than Boehm in C++ tbh | 12:26:59 |
emily | wouldn't recommend that under any circumstances. would be better to just punt on rooting by trampolining and only collecting when there are no active Rust frames than that (IIRC one of the major GC crates works this way, I forget which one) | 12:28:31 |
piegames | mostly lack of inlining, AFAICT, possibly also some ABI shenanigans w.r.t. which values have to go on the stack | 12:30:47 |
piegames | as in, linking objects written in two different languages presents an optimization boundary which prevents LTO | 12:31:19 |
emily | cross-language LTO will get you inlining | 12:31:22 |
Sergei Zimmerman (xokdvium) | Can’t you compile the C++ part to llvm it with C ABI and link that with the rust shim? | 12:33:07 |
emily | (and it's unlikely you can even measure ABi differences esp. since the less optimal case you is just what C++ uses for all code) | 12:33:18 |
emily | cxx binds directly to the Rust | 12:33:32 |
Sergei Zimmerman (xokdvium) | In reply to @xokdvium:matrix.org Can’t you compile the C++ part to llvm it with C ABI and link that with the rust shim? (That’s also compiled down to llvm-ir) | 12:33:32 |
emily | but yes you can LTO between the two languages | 12:33:40 |