TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Rustler – Safe Elixir and Erlang NIFs in Rust

201 点作者 hansihe超过 8 年前

5 条评论

moosingin3space超过 8 年前
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 未加载
kibwen超过 8 年前
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_ppp超过 8 年前
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.
fabian2k超过 8 年前
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 未加载
Anderkent超过 8 年前
&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 未加载