5 ms·
You could write NIFs in Rust (well not sure if you can now, but I don't see any reason it couldn't be supported) for the high perf bits and use Erlang to coordi
by wcummings 11y ago
You could write NIFs in Rust (well not sure if you can now, but I don't see any reason it couldn't be supported) for the high perf bits and use Erlang to coordinate, I figure. At least Rust code is less likely to explode and bring down the whole VM than C.
- kibwen 11y agoThere seem to be at least a few people looking to build NIFs in Rust, e.g. https://github.com/hansihe/Rustler https://github.com/hansihe/Rustler (found at https://news.ycombinator.com/item?id=11220615 https://news.ycombinator.com/item?id=11220615).
- vvanders 11y agoThat looks really nice. Codegen + panic catchers makes is pretty compelling.
- im_down_w_otp 11y agoHey, I'm one of those people! And yes, I am doing this, and the personal reason is for fault-tolerance and the professional reason (or how I get time to do it) is based on security criteria.
- arh68 11y agoAny idea if a network-level FFI has been started? I'm thinking along the lines of the Haskell erlang-ffi [0]. Speaks the Erlang network protocol and impersonates an Erlang node on the network. Fully capable of bi-directional communication with Erlang. NIFs still limit you to < ~1ms computations, from what I understand, but impersonating a node (on another machine, even) seems a lot more flexible. Just wondering; NIFs in Rust are still a great idea. [0] https://hackage.haskell.org/package/erlang https://hackage.haskell.org/package/erlang
- rdtsc 11y agoNot anymore with dirty schedulers you will be able to (as of 19.0 I think) have any long running C code as a NIF!
- toast0 11y agoHave you seen c nodes[1]? That may be what you're looking for? [1] http://erlang.org/doc/tutorial/cnode.html http://erlang.org/doc/tutorial/cnode.html
- wcummings 11y agoThere's support for "dirty NIFs" in new versions, R19 will make it the default. Dirty NIFs allow for long running NIFs managed by the VM. In older versions, you can use nif_create_thread to create background workers, and your NIF will only block for as long as it takes to acquire a lock for your queue. You can also use c nodes (or the JVM interface, which is pretty similar to c nodes I think). ... You can also use ports which define an interface for communicating with external processes. The world is your oyster!