!lymvtcwDJ7ZA9Npq:lix.systems

Lix Development

426 Members
(Technical) development of Lix, the package manager, a Nix implementation. Please be mindful of ongoing technical conversations in this channel.140 Servers

Load older messages


SenderMessageTime
20 Mar 2026
@emilazy:matrix.orgemilyrolling your own structures is probably preferable to the allocator API unless you truly can't get away with it sadly12:19:08
@emilazy:matrix.orgemilyright. but if binding to Boehm / letting C++ handle allocations and finalization is the short term plan I wouldn't think it'd make sense to move to something slower when it doesn't help gradually transition the Rust code to what will be required for rooting objects later anyway12:20:32
@piegames:flausch.socialpiegamesindeed12:21:48
@piegames:flausch.socialpiegamesthough it shall be noted that a) the current plan hinges on cxx working out (or some other form of ergonomic Rust C++ interop), and b) will come at an unknown performance cost due to FFI linking12:23:10
@piegames:flausch.socialpiegames* though it shall be noted that the current a) plan hinges on cxx working out (or some other form of ergonomic Rust C++ interop), and b) will come at an unknown performance cost due to FFI linking12:23:21
@xokdvium:matrix.orgSergei Zimmerman (xokdvium)I mean, it’s also possible to manually root with Boehm. There are callbacks for that - just a question of manually tracking roots on the rust side and throwing that over the fence into a Boehm callback12:23:46
@xokdvium:matrix.orgSergei Zimmerman (xokdvium)That’s how crystal does it with coroutines12:23:57
@emilazy:matrix.orgemilythere's no need for that I don't think12:24:08
@emilazy:matrix.orgemilythe Rust frames will look just like C++ ones as far as Boehm is concerned12:24:21
@xokdvium:matrix.orgSergei Zimmerman (xokdvium)I mean if it just lives on the stack/registers/TLS it would just work, yes.12:24:43
@piegames:flausch.socialpiegames 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
@emilazy:matrix.orgemily(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
@emilazy:matrix.orgemilywhat do you mean by perf cost due to FFI linking?12:26:17
@emilazy:matrix.orgemilymanual rooting without an API that enforces it is vastly less safe than Boehm in C++ tbh12:26:59
@emilazy:matrix.orgemilywouldn'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:flausch.socialpiegamesmostly lack of inlining, AFAICT, possibly also some ABI shenanigans w.r.t. which values have to go on the stack12:30:47
@piegames:flausch.socialpiegamesas in, linking objects written in two different languages presents an optimization boundary which prevents LTO12:31:19
@emilazy:matrix.orgemilycross-language LTO will get you inlining12:31:22
@xokdvium:matrix.orgSergei 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
@emilazy:matrix.orgemily(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
@emilazy:matrix.orgemilycxx binds directly to the Rust12:33:32
@xokdvium:matrix.orgSergei 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
@emilazy:matrix.orgemilybut yes you can LTO between the two languages12:33:40
@emilazy:matrix.orgemilythe Rust toolchain has specific support for it12:34:00
@xokdvium:matrix.orgSergei Zimmerman (xokdvium)Well fat lto is basically just linking llvm ir modules together, right?12:34:06
@emilazy:matrix.orgemilyyeah12:34:13
@emilazy:matrix.orgemilybut you can do cross language thinlto too12:34:21
@emilazy:matrix.orgemilyhttps://doc.rust-lang.org/rustc/linker-plugin-lto.html12:35:14
@emilazy:matrix.orgemily (for clarity: cxx is a Rust crate. it just layers on top of native C FFI in Rust to bind to C++) 12:37:56
@emilazy:matrix.orgemily(incl interop with C++ smart pointers etc.)12:38:14

Show newer messages


Back to Room ListRoom Version: 10