top | item 44919169

(no title)

Zxian | 6 months ago

I'd also recommend having a look at the Zig library for Elixir. For simple stuff, you can just inline, but support for pretty complex setups too.

Also comes with a built-in BEAM allocator so the runtime properly reports NIF memory consumption.

https://hexdocs.pm/zigler/Zig.html

discuss

order

overbring_labs|6 months ago

Thanks, one day I'll look into Zig too, because I've been impressed with what Tigerbeetle has achieved with it! For now, I'm all-in on Elixir.

dnautics|6 months ago

you can use zigler for a c nif, using easy_c (or c_src) options.

the big advantage is that it will automatically box/unbox to/from c values for you and generate sane error messages (which rustler does not, last i checked) when you pass incompatible terms in to the function.

on the other hand rustler lets you precompile (which is coming in a future version of Zigler)