TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Rustler – Safe Elixir and Erlang NIFs in Rust

201 pointsby hansiheover 8 years ago

5 comments

moosingin3spaceover 8 years ago
This, IMO, is quite possibly the best instance of "best tool for the job" I've ever seen. Rust is great for writing high-performance code, and Erlang is fantastic for distributed systems.
评论 #13613725 未加载
kibwenover 8 years ago
I've been very excited at Rust's prospects as an alternative to C for extending all sorts of higher-level languages, but I'm most excited at the prospect of combining Rust with Erlang given the latter's focus on reliability. I'd love to figure out where Erlang programmers hang out to ask them what they think about using Rust for NIFs.
评论 #13610635 未加载
评论 #13611275 未加载
评论 #13610254 未加载
andy_pppover 8 years ago
Really nice to see this linked here, I was chatting with hansihe about getting the html5ever parser from servo into a nif and he magically created it here:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;hansihe&#x2F;html5ever_elixir" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;hansihe&#x2F;html5ever_elixir</a><p>It shows how create a threadpool and avoid the 1ms maximum nif execution time too.
fabian2kover 8 years ago
NIFs are the fastest method to call external code from Erlang&#x2F;Elixir, as far as I understand. But I wonder how high the actual overhead is.<p>My understanding is that if I still want to ensure that the Beam VM can continue to schedule all processes efficiently, these NIFs shouldn&#x27;t calculate forever, but return quickly to avoid blocking all other processes. So the straightforward way to ensure this for longer calculations would be to split the calculation in smaller, parallelizable jobs, if that is possible. But then the overhead of calling NIFs might actually matter, if you split them into chunks that are too small.<p>I&#x27;ve no idea how big the overhead actually is, I&#x27;d be interested in a rough estimate. Is it small enough that I can just ignore it entirely?
评论 #13610804 未加载
评论 #13610901 未加载
评论 #13611577 未加载
评论 #13610884 未加载
评论 #13611194 未加载
Anderkentover 8 years ago
&gt; This means you can write and run totally safe code in Rust, no worrying about segfaults.<p>This is not quite accurate; you can still segfault rust writing 100% safe code, for example if you have a large stack overflow ever since __morestack was killed.<p>Though these cases are fortunately rare
评论 #13612039 未加载