Attempt at adapting KuzuDB's Rust crate into Elixir via NIF, any tips/thoughts?

Bold statement to say something is safer than Rust. :smiley:

Welll, not saying the Rust lib isn’t safe, just the interaction between BEAM/Rust :wink:

Well, ports give you process isolation. Performance with export/erlport will not be great, though (but you seem to have taken this into consideration). In my internal fork I sped it up a bit by using memory views, maybe I’ll upstream that this weekend, but it is still a binary parser/writer written in Python.

Do you have a concrete case of unsafe interaction? We try quite hard to wrap the interfaces in a safe way. As long as you stay in safe Rust, the interaction is safe (with the usual NIF caveat about long runtimes).

To be fair to Rustler, I think my “unsafe interaction” was actually a bug on my part. I suspect my NIF was taking too long, so I’ve since added the “DirtyCpu” flag. By the time I made that change, I had already created kuzu_pyport_ex. Since I don’t need super high performance, I’ve already switched.