3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Port を rust で書いてみた

Posted at

前回「C node を rust で書いてみた」では
「ElixirからRustの関数をつかう → はやい」のお題を C Node でやりました 。

今回は Port で書いてみます。

0. 環境

os: darwin-15.6.0 / MacBook Air(Mid 2011)

erlang: 19.0(erl_interface: 3.9)/ kerl で野良ビルド
rust: 1.11.0 / homebrew版

src は v0.1.1 です。

1. 実行

$ cargo build --example port
...
$ cd examples
$ erl
Eshell V8.0  (abort with ^G)
1> c(port).
{ok,port}
2> {ok,P} = port:start_link().
{ok,<0.63.0>}
3> timer:tc(port, pi, [P,1000000000,10]).
{16531378,{ok,3.141592655589816}}
4> port:stop(P).

はや、くはないですね。前回と変わる要素もないですが。

まとめ

v0.1.1 は '全力で spawn する' とか、'キレイに終われない' 等々ありますが、C Node より断然スッキリ。

頑張るならやはり Port の方が良さそうです。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?