Rust実装のabライクなツール boom-rustを書きました

最近会社のエンジニアでも Rust を使っている方がいてモチベーションさらに上がってきました。 近くで話せる人がいるというのはいいですね。といっても大阪と東京で離れてはいますが。

で、本題ですが、 boom-rust というabライクなツールを書いてみました。 もともと Python実装のboomGo実装 があり、Rustで実装したらでどれくらいパフォーマンス違うのかなというのを比較できるかなと思い書いてみた次第です。

モチベーション

今自分の中でRustについていろいろ調べたり知見ためているところで、 小さなツールとかからプロダクション環境に投入していきたいなと考えてるところです。 その知見ためる一環として実際のツールなりライブラリをいろいろ書いていこうというのがあり、 boom-rustもそういうモチベーションで書きました。

今そういったツールは主にGoで書いてたりするので、 特にGoと比較してアドバンテージがあるのかなというところが目下気になっているところです。

パフォーマンス測定

計測マシン

  • MacOSX 10.11.6 (iMac 21.5-inch, Late 2012/3.1 GHz Intel Core i7/16 GB 1600 MHz DDR3)
  • Arch Linux 2016.08.31 on Vagrant(VirtualBox)/cpu:2Core/mem:2GB
  • Rust 1.11
  • Go 1.7

サーバはPython(gevent)で実装された十分高速なHello worldだけ返す仕様。 boomのコマンドオプション -n はリクエスト数、 -c は並行処理数。

ツール実行をtimeで計測

まずはツール実行結果(Go)

vagrant@archlinux:~$ time boom -n 100000 -c 10 http://0.0.0.0:8889/
Summary:
  Total:    41.7039 secs
  Slowest:  0.5160 secs
  Fastest:  0.0000 secs
  Average:  0.0039 secs
  Requests/sec:     2397.8582
  Total data:       1100000 bytes
  Size/request:     11 bytes

Status code distribution:
  [200]     100000 responses

Response time histogram:
  0.000 [1] |
  0.052 [98524]     |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  0.103 [949]       |
  0.155 [270]       |
  0.206 [94]        |
  0.258 [56]        |
  0.310 [14]        |
  0.361 [37]        |
  0.413 [27]        |
  0.464 [12]        |
  0.516 [16]        |

Latency distribution:
  10% in 0.0004 secs
  25% in 0.0004 secs
  50% in 0.0005 secs
  75% in 0.0032 secs
  90% in 0.0060 secs
  95% in 0.0077 secs
  99% in 0.0730 secs

real        0m41.749s
user        0m6.497s
sys 0m11.330s

続いてRust

vagrant@archlinux:~$ time boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
Summary:
  Total:        35.23537 s
  Slowest:      0.67954 s
  Fastest:      0.00000 s
  Average:      0.00244 s
  Requests/sec: 2838.06
  Total data:   1100000 bytes
  Size/request: 11 bytes

Status code distribution:
  [200] 100000 responses

Response time histogram:
  0.000 [94348]     |****************************************
  0.068 [4931]      |**
  0.136 [121]       |
  0.204 [128]       |
  0.272 [141]       |
  0.340 [146]       |
  0.408 [59]        |
  0.476 [27]        |
  0.544 [58]        |
  0.612 [26]        |
  0.680 [15]        |

Latency distribution:
  95% in 0.0010 secs
  99% in 0.0030 secs

real        0m35.260s
user        0m3.213s
sys 0m3.563s

ツール実行時のpsでのプロセスリソース確認結果(Go)

vagrant   5009  0.0  0.3 124432  7848 pts/2    Sl+  03:23   0:00 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 36.0  0.4 198292  8256 pts/2    Sl+  03:23   0:00 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 61.0  0.4 198292  8256 pts/2    Sl+  03:23   0:00 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 40.5  0.4 198292  8256 pts/2    Sl+  03:23   0:00 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 48.5  0.4 198292  8256 pts/2    Sl+  03:23   0:00 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 39.0  0.4 198292  8256 pts/2    Sl+  03:23   0:01 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 46.0  0.4 198292  8256 pts/2    Sl+  03:23   0:01 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 39.7  0.4 198292  8256 pts/2    Sl+  03:23   0:01 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 45.7  0.4 198292  8480 pts/2    Sl+  03:23   0:01 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 41.2  0.4 198292  8480 pts/2    Sl+  03:23   0:02 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 46.2  0.4 198292  8480 pts/2    Sl+  03:23   0:02 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.6  0.5 419488 10528 pts/2    Sl+  03:23   0:02 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 46.8  0.5 419488 10528 pts/2    Sl+  03:23   0:02 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.4  0.5 419488 10528 pts/2    Sl+  03:23   0:03 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 46.5  0.5 420544 10528 pts/2    Sl+  03:23   0:03 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 44.1  0.5 420544 10528 pts/2    Sl+  03:23   0:03 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 47.0  0.5 420544 10948 pts/2    Sl+  03:23   0:03 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 44.0  0.5 420544 11156 pts/2    Sl+  03:23   0:03 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 45.8  0.5 420544 11156 pts/2    Sl+  03:23   0:04 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.2  0.5 420544 11344 pts/2    Sl+  03:23   0:04 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 45.5  0.5 420544 11344 pts/2    Sl+  03:23   0:04 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.2  0.5 420544 11572 pts/2    Sl+  03:23   0:04 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 41.2  0.5 420544 11572 pts/2    Sl+  03:23   0:04 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.8  0.5 420544 11796 pts/2    Sl+  03:23   0:05 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 41.3  0.5 421600 12032 pts/2    Sl+  03:23   0:05 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.0  0.5 421600 12032 pts/2    Sl+  03:23   0:05 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 41.5  0.5 421600 12212 pts/2    Sl+  03:23   0:05 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.0  0.5 421600 12212 pts/2    Sl+  03:23   0:06 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 41.4  0.6 421600 12400 pts/2    Sl+  03:23   0:06 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.8  0.6 421600 12620 pts/2    Sl+  03:23   0:06 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 41.3  0.6 421600 12824 pts/2    Sl+  03:23   0:06 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.6  0.6 421600 13036 pts/2    Sl+  03:23   0:06 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 41.3  0.6 421600 13208 pts/2    Sl+  03:23   0:07 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.7  0.6 422656 13208 pts/2    Sl+  03:23   0:07 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 41.7  0.6 422912 13388 pts/2    Sl+  03:23   0:07 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.1  0.6 422912 13764 pts/2    Sl+  03:23   0:07 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.0  0.6 422912 13764 pts/2    Sl+  03:23   0:07 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.4  0.6 422912 13928 pts/2    Sl+  03:23   0:08 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.4  0.6 422912 13928 pts/2    Sl+  03:23   0:08 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.7  0.6 422912 13928 pts/2    Sl+  03:23   0:08 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.6  0.6 423972 14292 pts/2    Sl+  03:23   0:08 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.5  0.6 423972 14292 pts/2    Sl+  03:23   0:09 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.5  0.7 423972 14636 pts/2    Sl+  03:23   0:09 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 41.7  0.7 423972 14796 pts/2    Sl+  03:23   0:09 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.7  0.7 423972 14796 pts/2    Sl+  03:23   0:09 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 41.8  0.7 423972 14796 pts/2    Sl+  03:23   0:10 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.8  0.7 423972 14960 pts/2    Sl+  03:23   0:10 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.2  0.7 423972 14960 pts/2    Sl+  03:23   0:10 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.2  0.7 423972 15328 pts/2    Sl+  03:23   0:10 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.5  0.7 425028 15688 pts/2    Sl+  03:23   0:11 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.5  0.7 425028 15860 pts/2    Sl+  03:23   0:11 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.9  0.7 425028 16020 pts/2    Sl+  03:23   0:11 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.9  0.7 425284 16020 pts/2    Sl+  03:23   0:11 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.2  0.7 425284 16020 pts/2    Sl+  03:23   0:12 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 44.0  0.7 425284 16020 pts/2    Sl+  03:23   0:12 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.2  0.7 425284 16192 pts/2    Sl+  03:23   0:12 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.8  0.8 425284 16544 pts/2    Sl+  03:23   0:12 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.0  0.8 425284 16544 pts/2    Sl+  03:23   0:12 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.8  0.8 425284 16544 pts/2    Sl+  03:23   0:13 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.1  0.8 425284 16868 pts/2    Sl+  03:23   0:13 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.9  0.8 426340 17040 pts/2    Sl+  03:23   0:13 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.2  0.8 426596 17040 pts/2    Sl+  03:23   0:13 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.8  0.8 426596 17424 pts/2    Sl+  03:23   0:14 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.2  0.8 426596 17424 pts/2    Sl+  03:23   0:14 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.8  0.8 426596 17424 pts/2    Sl+  03:23   0:14 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.1  0.8 426596 17772 pts/2    Sl+  03:23   0:14 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.8  0.8 426596 17772 pts/2    Sl+  03:23   0:14 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.2  0.8 426596 17948 pts/2    Sl+  03:23   0:15 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.5  0.8 426596 17948 pts/2    Sl+  03:23   0:15 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.0  0.8 426596 18120 pts/2    Sl+  03:23   0:15 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.4  0.9 427652 18480 pts/2    Sl+  03:23   0:15 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.1  0.9 427652 18480 pts/2    Sl+  03:23   0:15 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.6  0.9 427652 18480 pts/2    Sl+  03:23   0:16 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.1  0.9 427652 18664 pts/2    Sl+  03:23   0:16 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.5  0.9 427652 18832 pts/2    Sl+  03:23   0:16 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.1  0.9 427652 18832 pts/2    Sl+  03:23   0:16 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.6  0.9 427652 18832 pts/2    Sl+  03:23   0:17 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.0  0.9 427652 19220 pts/2    Sl+  03:23   0:17 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 42.5  0.9 427652 19220 pts/2    Sl+  03:23   0:17 boom -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   5009 43.0  0.9 428712 19556 pts/2    Sl+  03:23   0:17 boom -n 100000 -c 10 http://0.0.0.0:8889/

おおよそCPU使用率が40〜50%程度、実メモリ使用(RSS)が最大で19MB前後。

ツール実行時のpsでのプロセスリソース確認結果(Rust)

vagrant   4612 14.0  3.1  98264 65224 pts/2    Sl+  03:23   0:00 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 26.0  3.1  98264 65224 pts/2    Sl+  03:23   0:00 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.5  3.1  98264 65224 pts/2    Sl+  03:23   0:00 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 23.0  3.1  98264 65224 pts/2    Sl+  03:23   0:00 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 17.6  3.1  98264 65224 pts/2    Sl+  03:23   0:00 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 20.3  3.1  98264 65224 pts/2    Sl+  03:23   0:00 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 17.2  3.1  98264 65224 pts/2    Sl+  03:23   0:00 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 19.5  3.1  98264 65224 pts/2    Sl+  03:23   0:00 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 17.2  3.1  98264 65224 pts/2    Sl+  03:23   0:00 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.8  3.1  98264 65224 pts/2    Sl+  03:23   0:00 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 16.8  3.1  98264 65224 pts/2    Sl+  03:23   0:01 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.1  3.1  98264 65224 pts/2    Sl+  03:23   0:01 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 17.4  3.0  98256 63200 pts/2    Sl+  03:23   0:01 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 19.0  3.0  98256 63200 pts/2    Sl+  03:23   0:01 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.1  3.0  98256 63200 pts/2    Sl+  03:23   0:01 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 19.5  3.0  98256 63200 pts/2    Sl+  03:23   0:01 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.4  3.0  98256 63200 pts/2    Sl+  03:23   0:01 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 19.7  3.0  98256 63200 pts/2    Sl+  03:23   0:01 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.8  3.0  98256 63200 pts/2    Sl+  03:23   0:01 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 19.6  3.0  98256 63200 pts/2    Sl+  03:23   0:01 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.6  3.0  98256 63200 pts/2    Sl+  03:23   0:02 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 19.3  2.9  98248 61240 pts/2    Sl+  03:23   0:02 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.6  2.9  98248 61240 pts/2    Sl+  03:23   0:02 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.0  2.9  98248 61240 pts/2    Sl+  03:23   0:02 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.9  2.9  98248 61240 pts/2    Sl+  03:23   0:02 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.1  2.9  98248 61240 pts/2    Sl+  03:23   0:02 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.7  2.9  98248 61240 pts/2    Sl+  03:23   0:02 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 17.9  2.9  98248 61240 pts/2    Sl+  03:23   0:02 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.4  2.9  98248 61240 pts/2    Sl+  03:23   0:02 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 17.8  2.9  98248 61240 pts/2    Sl+  03:23   0:02 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.2  2.9  98248 61240 pts/2    Sl+  03:23   0:02 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 17.7  2.9  98248 61240 pts/2    Sl+  03:23   0:03 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.1  2.9  98240 61256 pts/2    Sl+  03:23   0:03 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 17.5  2.9  98240 61256 pts/2    Sl+  03:23   0:03 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 17.9  2.9  98240 61256 pts/2    Sl+  03:23   0:03 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 17.4  2.9  98240 61256 pts/2    Sl+  03:23   0:03 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 17.8  2.9  98240 61256 pts/2    Sl+  03:23   0:03 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 17.4  2.9  98240 61256 pts/2    Sl+  03:23   0:03 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.0  2.9  98240 61256 pts/2    Sl+  03:23   0:03 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 17.6  2.9  98240 61256 pts/2    Sl+  03:23   0:03 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.0  2.9  98240 61256 pts/2    Sl+  03:23   0:03 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 17.6  2.9  98240 61256 pts/2    Sl+  03:23   0:03 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.0  2.9  98240 61256 pts/2    Sl+  03:23   0:03 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 17.7  2.9  98240 61256 pts/2    Sl+  03:23   0:04 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.2  2.9  98240 61256 pts/2    Sl+  03:23   0:04 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 17.8  2.9  98240 61256 pts/2    Sl+  03:23   0:04 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.2  2.9  98232 61016 pts/2    Sl+  03:23   0:04 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.0  2.9  98232 61016 pts/2    Sl+  03:23   0:04 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.4  2.9  98232 61016 pts/2    Sl+  03:23   0:04 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.1  2.9  98232 61016 pts/2    Sl+  03:23   0:04 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 17.8  2.9  98232 61016 pts/2    Sl+  03:23   0:04 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.2  2.9  98224 60800 pts/2    Sl+  03:23   0:04 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.0  2.7  98224 56820 pts/2    Sl+  03:23   0:05 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.5  2.7  98224 56820 pts/2    Sl+  03:23   0:05 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.3  2.6  98224 54508 pts/2    Sl+  03:23   0:05 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.6  2.6  98224 54508 pts/2    Sl+  03:23   0:05 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.6  2.5  98216 53008 pts/2    Sl+  03:23   0:05 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.9  2.5  98216 53008 pts/2    Sl+  03:23   0:05 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.5  2.5  98216 53008 pts/2    Sl+  03:23   0:05 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.8  2.5  98216 53008 pts/2    Sl+  03:23   0:05 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.5  2.4  98216 49784 pts/2    Sl+  03:23   0:05 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.9  2.2  98200 45612 pts/2    Sl+  03:23   0:06 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.6  2.0  98200 42992 pts/2    Sl+  03:23   0:06 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 19.0  1.9  98200 40836 pts/2    Sl+  03:23   0:06 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.8  1.9  98200 40836 pts/2    Sl+  03:23   0:06 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 19.1  1.8  98192 38712 pts/2    Sl+  03:23   0:06 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 18.9  1.5  98192 32288 pts/2    Sl+  03:23   0:06 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
vagrant   4612 19.2  1.3  98192 28000 pts/2    Sl+  03:23   0:06 boom-rust -n 100000 -c 10 http://0.0.0.0:8889/

おおよそCPU使用率が16〜20%程度、実メモリ使用(RSS)が最大で65MB前後。 Rust実装の方がCPU使用率は低く、メモリ使用量は多いという結果に。

pidstatによる並行処理数別のパフォーマンス計測

pidstatでも結果を確認してみます。 今度は -c オプショオンを変化させてみて、どのくらいパフォーマンスが変わるのかを確認します。

concurrency別(Go)

vagrant@archlinux:~$ pidstat -druwh -G boom 1
Linux 4.7.2-1-ARCH (archlinux.vagrant.vm)   02/09/16        _x86_64_        (2 CPU)

[[-c=1
#      Time   UID       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ     RSS   %MEM   kB_rd/s   kB_wr/s kB_ccwr/s iodelay   cswch/s nvcswch/s  Command
 1472751247   998      1042   11.00   33.00    0.00   44.00     0   1964.00      0.00  132756    8804   0.43      0.00      0.00      0.00       0      3.00      1.00  boom
 1472751248   998      1042   11.00   38.00    0.00   49.00     0     56.00      0.00  132756    8904   0.43      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751249   998      1042   18.00   31.00    0.00   49.00     0     23.00      0.00  132756    8904   0.43      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751250   998      1042   16.00   31.00    0.00   47.00     0     18.00      0.00  132756    8904   0.43      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751251   998      1042   18.00   33.00    0.00   51.00     0     14.00      0.00  132756    9120   0.44      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751252   998      1042   15.00   39.00    0.00   54.00     0     17.00      0.00  132756    9120   0.44      0.00      0.00      0.00       0      0.00      0.00  boom

[[-c=2
#      Time   UID       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ     RSS   %MEM   kB_rd/s   kB_wr/s kB_ccwr/s iodelay   cswch/s nvcswch/s  Command
 1472751260   998      1049    6.00   14.00    0.00   20.00     1   1840.00      0.00  198228   10892   0.53      0.00      0.00      0.00       0      3.00      1.00  boom
 1472751261   998      1049   17.00   33.00    0.00   50.00     1    151.00      0.00  198292   11264   0.55      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751262   998      1049   18.00   34.00    0.00   52.00     1     55.00      0.00  198292   11468   0.56      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751263   998      1049   16.00   28.00    0.00   44.00     1     19.00      0.00  198292   11468   0.56      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751264   998      1049   17.00   32.00    0.00   49.00     1     17.00      0.00  272024   11468   0.56      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751265   998      1049   18.00   31.00    0.00   49.00     1     35.00      0.00  272024   11468   0.56      0.00      0.00      0.00       0      0.00      0.00  boom

[[-c=4
#      Time   UID       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ     RSS   %MEM   kB_rd/s   kB_wr/s kB_ccwr/s iodelay   cswch/s nvcswch/s  Command
 1472751274   998      1057    1.00    4.00    0.00    5.00     0   1143.00      0.00  187852    6872   0.33      0.00      0.00      0.00       0      3.00      2.00  boom
 1472751275   998      1057   13.00   37.00    0.00   50.00     0    903.00      0.00  263828    8800   0.43      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751276   998      1057   17.00   33.00    0.00   50.00     0     56.00      0.00  263828    9200   0.45      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751277   998      1057   18.00   30.00    0.00   48.00     0     20.00      0.00  263828    9200   0.45      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751278   998      1057   17.00   31.00    0.00   48.00     0     26.00      0.00  263828    9200   0.45      0.00      0.00      0.00       0      0.00      0.00  boom

[[-c=8
#      Time   UID       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ     RSS   %MEM   kB_rd/s   kB_wr/s kB_ccwr/s iodelay   cswch/s nvcswch/s  Command
 1472751290   998      1064   12.00   25.00    0.00   37.00     0   1991.00      0.00  198292    8892   0.43      0.00      0.00      0.00       0      2.00      2.00  boom
 1472751291   998      1064   22.00   34.00    0.00   56.00     0     85.00      0.00  198292    9072   0.44      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751292   998      1064   18.00   42.00    0.00   60.00     0     38.00      0.00  198292    9412   0.46      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751293   998      1064   20.00   39.00    0.00   59.00     0     21.00      0.00  198292    9412   0.46      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751294   998      1064   16.00   31.00    0.00   47.00     0     19.00      0.00  198292    9412   0.46      0.00      0.00      0.00       0      0.00      0.00  boom

[[-c=16
#      Time   UID       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ     RSS   %MEM   kB_rd/s   kB_wr/s kB_ccwr/s iodelay   cswch/s nvcswch/s  Command
 1472751303   998      1071   19.00   35.00    0.00   54.00     0   2026.00      0.00  198292    9048   0.44      0.00      0.00      0.00       0      3.00      2.00  boom
 1472751304   998      1071   14.00   33.00    0.00   47.00     0     59.00      0.00  198292    9480   0.46      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751305   998      1071   15.00   33.00    0.00   48.00     0     17.00      0.00  198292    9480   0.46      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751306   998      1071   17.00   33.00    0.00   50.00     0     29.00      0.00  198292    9480   0.46      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751307   998      1071   20.00   30.00    0.00   50.00     0     18.00      0.00  198292    9480   0.46      0.00      0.00      0.00       0      0.00      0.00  boom

[[-c=32
#      Time   UID       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ     RSS   %MEM   kB_rd/s   kB_wr/s kB_ccwr/s iodelay   cswch/s nvcswch/s  Command
 1472751317   998      1078    8.00   10.00    0.00   18.00     0   1997.00      0.00  132692   11344   0.55      0.00      0.00      0.00       0      4.00      2.00  boom
 1472751318   998      1078   17.00   30.00    0.00   47.00     0    129.00      0.00  133812   11724   0.57      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751319   998      1078   29.00   24.00    0.00   53.00     0     17.00      0.00  133812   11724   0.57      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751320   998      1078   22.00   28.00    0.00   50.00     0     45.00      0.00  133812   11880   0.58      0.00      0.00      0.00       0      0.00      0.00  boom
 1472751321   998      1078   16.00   35.00    0.00   51.00     0     26.00      0.00  133812   11880   0.58      0.00      0.00      0.00       0      0.00      0.00  boom

CPU使用率、メモリ使用量ともにそこまで変化しないように見える。

concurrency別(Rust)

vagrant@archlinux:~$ pidstat -druwh -G boom 1
Linux 4.7.2-1-ARCH (archlinux.vagrant.vm)   02/09/16        _x86_64_        (2 CPU)

[[-c=1
#      Time   UID       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ     RSS   %MEM   kB_rd/s   kB_wr/s kB_ccwr/s iodelay   cswch/s nvcswch/s  Command
 1472751343   998      1086    3.00    4.00    0.00    7.00     0    330.00     12.00   38764   19636   0.96   2080.00      0.00      0.00      14     20.00     19.00  boom-rust
 1472751344   998      1086   16.00   12.00    0.00   28.00     0      0.00      0.00   38764   19636   0.96      0.00      0.00      0.00       0      0.00      0.00  boom-rust
 1472751345   998      1086   11.00   17.00    0.00   28.00     0      0.00      0.00   38764   17144   0.83      0.00      0.00      0.00       0      0.00      0.00  boom-rust
 1472751346   998      1086   14.00   14.00    0.00   28.00     0      0.00      0.00   38764   17016   0.83      0.00      0.00      0.00       0      0.00      0.00  boom-rust
 1472751347   998      1086   14.00   14.00    0.00   28.00     0      0.00      0.00   38764   14948   0.73      0.00      0.00      0.00       0      0.00      0.00  boom-rust

[[-c=2
#      Time   UID       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ     RSS   %MEM   kB_rd/s   kB_wr/s kB_ccwr/s iodelay   cswch/s nvcswch/s  Command
 1472751353   998      1088    7.00    4.00    0.00   11.00     0    342.00      0.00   42872   21784   1.06      0.00      0.00      0.00       0      1.00      8.00  boom-rust
 1472751354   998      1088   18.00   14.00    0.00   32.00     0      0.00      0.00   42872   21332   1.04      0.00      0.00      0.00       0      0.00      0.00  boom-rust
 1472751355   998      1088   19.00   13.00    0.00   32.00     0      0.00      0.00   42872   19160   0.93      0.00      0.00      0.00       0      0.00      0.00  boom-rust
 1472751356   998      1088   14.00   12.00    0.00   26.00     0      0.00      0.00   42864   17084   0.83      0.00      0.00      0.00       0      1.00      0.00  boom-rust

[[-c=4
#      Time   UID       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ     RSS   %MEM   kB_rd/s   kB_wr/s kB_ccwr/s iodelay   cswch/s nvcswch/s  Command
 1472751366   998      1091   19.00   13.00    0.00   32.00     1    366.00      0.00   51088   26060   1.27      0.00      0.00      0.00       0      2.00      4.00  boom-rust
 1472751367   998      1091   16.00    9.00    0.00   25.00     1      0.00      0.00   51088   26060   1.27      0.00      0.00      0.00       0      0.00      0.00  boom-rust
 1472751368   998      1091   17.00    9.00    0.00   26.00     1      0.00      0.00   51072   23440   1.14      0.00      0.00      0.00       0      2.00      0.00  boom-rust
 1472751369   998      1091   19.00    6.00    0.00   25.00     1      0.00      0.00   51064   19192   0.93      0.00      0.00      0.00       0      0.00      0.00  boom-rust

[[-c=8
#      Time   UID       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ     RSS   %MEM   kB_rd/s   kB_wr/s kB_ccwr/s iodelay   cswch/s nvcswch/s  Command
 1472751379   998      1096   13.00   13.00    0.00   26.00     0    400.00      0.00   65472   34280   1.67      0.00      0.00      0.00       0     11.00     25.00  boom-rust
 1472751380   998      1096   21.00   12.00    0.00   33.00     0      0.00      0.00   65472   31708   1.54      0.00      0.00      0.00       0      0.00      0.00  boom-rust
 1472751381   998      1096   15.00   19.00    0.00   34.00     0      0.00      0.00   65472   29524   1.44      0.00      0.00      0.00       0      0.00      0.00  boom-rust
 1472751382   998      1096   18.00   15.00    0.00   33.00     0      0.00      0.00   65472   29524   1.44      0.00      0.00      0.00       0      0.00      0.00  boom-rust

[[-c=16
#      Time   UID       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ     RSS   %MEM   kB_rd/s   kB_wr/s kB_ccwr/s iodelay   cswch/s nvcswch/s  Command
 1472751388   998      1105    6.00    3.00    0.00    9.00     0    454.00      0.00   81952   42712   2.08      0.00      0.00      0.00       0     23.00     51.00  boom-rust
 1472751389   998      1105   23.00   12.00    0.00   35.00     0      0.00      0.00   81952   42712   2.08      0.00      0.00      0.00       0      0.00      0.00  boom-rust
 1472751390   998      1105   17.00   17.00    0.00   34.00     0      0.00      0.00   81952   40440   1.97      0.00      0.00      0.00       0      0.00      0.00  boom-rust
 1472751391   998      1105   17.00   16.00    0.00   33.00     0      0.00      0.00   81952   38196   1.86      0.00      0.00      0.00       0      0.00      0.00  boom-rust

[[-c=32
#      Time   UID       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ     RSS   %MEM   kB_rd/s   kB_wr/s kB_ccwr/s iodelay   cswch/s nvcswch/s  Command
 1472751413   998      1156   12.00    9.00    0.00   21.00     0    617.00      0.00  116944   44904   2.19      0.00      0.00      0.00       0     49.00     26.00  boom-rust
 1472751414   998      1156   17.00   18.00    0.00   35.00     0      0.00      0.00  116944   44904   2.19      0.00      0.00      0.00       0      0.00      0.00  boom-rust
 1472751415   998      1156   19.00   14.00    0.00   33.00     0      0.00      0.00  116936   42320   2.06      0.00      0.00      0.00       0      0.00      0.00  boom-rust
 1472751416   998      1156   19.00   14.00    0.00   33.00     0      0.00      0.00  116928   39820   1.94      0.00      0.00      0.00       0      0.00      0.00  boom-rust

CPU使用率はほぼ変化なし、メモリ使用量はおおよそ線形に増えてるように見える。

pmapによるメモリ使用量の計測

続いてはメモリマップ。5、6秒経過して安定したところで pmap -x PID を実行します。

Go

vagrant@archlinux:~$ pmap -x `pgrep boom`
6652:   boom -n 100000 -c 10 http://0.0.0.0:8889/
Address           Kbytes     RSS   Dirty Mode  Mapping
0000000000400000    2132    2028       0 r-x-- boom
0000000000400000       0       0       0 r-x-- boom
0000000000615000    1600    1428       0 r---- boom
0000000000615000       0       0       0 r---- boom
00000000007a5000     128     128      72 rw--- boom
00000000007a5000       0       0       0 rw--- boom
00000000007c5000     144      64      64 rw---   [ anon ]
00000000007c5000       0       0       0 rw---   [ anon ]
0000000002250000     132       4       4 rw---   [ anon ]
0000000002250000       0       0       0 rw---   [ anon ]
000000c000000000       8       8       8 rw---   [ anon ]
000000c000000000       0       0       0 rw---   [ anon ]
000000c41ffd8000    5280    4008    4008 rw---   [ anon ]
000000c41ffd8000       0       0       0 rw---   [ anon ]
00007fbd64000000     132       4       4 rw---   [ anon ]
00007fbd64000000       0       0       0 rw---   [ anon ]
00007fbd64021000   65404       0       0 -----   [ anon ]
00007fbd64021000       0       0       0 -----   [ anon ]
00007fbd6b7ff000       4       0       0 -----   [ anon ]
00007fbd6b7ff000       0       0       0 -----   [ anon ]
00007fbd6b800000    8192    2048    2048 rw---   [ anon ]
00007fbd6b800000       0       0       0 rw---   [ anon ]
00007fbd6c000000     132       4       4 rw---   [ anon ]
00007fbd6c000000       0       0       0 rw---   [ anon ]
00007fbd6c021000   65404       0       0 -----   [ anon ]
00007fbd6c021000       0       0       0 -----   [ anon ]
00007fbd701f4000       4       0       0 -----   [ anon ]
00007fbd701f4000       0       0       0 -----   [ anon ]
00007fbd701f5000    8192       8       8 rw---   [ anon ]
00007fbd701f5000       0       0       0 rw---   [ anon ]
00007fbd709f5000       4       0       0 -----   [ anon ]
00007fbd709f5000       0       0       0 -----   [ anon ]
00007fbd709f6000    9600      92      92 rw---   [ anon ]
00007fbd709f6000       0       0       0 rw---   [ anon ]
00007fbd71356000       4       0       0 -----   [ anon ]
00007fbd71356000       0       0       0 -----   [ anon ]
00007fbd71357000    8192       8       8 rw---   [ anon ]
00007fbd71357000       0       0       0 rw---   [ anon ]
00007fbd71b57000       4       0       0 -----   [ anon ]
00007fbd71b57000       0       0       0 -----   [ anon ]
00007fbd71b58000    8192       8       8 rw---   [ anon ]
00007fbd71b58000       0       0       0 rw---   [ anon ]
00007fbd72358000       4       0       0 -----   [ anon ]
00007fbd72358000       0       0       0 -----   [ anon ]
00007fbd72359000    8192       8       8 rw---   [ anon ]
00007fbd72359000       0       0       0 rw---   [ anon ]
00007fbd72b59000    1620     732       0 r-x-- libc-2.24.so
00007fbd72b59000       0       0       0 r-x-- libc-2.24.so
00007fbd72cee000    2044       0       0 ----- libc-2.24.so
00007fbd72cee000       0       0       0 ----- libc-2.24.so
00007fbd72eed000      16      16      16 r---- libc-2.24.so
00007fbd72eed000       0       0       0 r---- libc-2.24.so
00007fbd72ef1000       8       8       8 rw--- libc-2.24.so
00007fbd72ef1000       0       0       0 rw--- libc-2.24.so
00007fbd72ef3000      16      12      12 rw---   [ anon ]
00007fbd72ef3000       0       0       0 rw---   [ anon ]
00007fbd72ef7000      96      96       0 r-x-- libpthread-2.24.so
00007fbd72ef7000       0       0       0 r-x-- libpthread-2.24.so
00007fbd72f0f000    2044       0       0 ----- libpthread-2.24.so
00007fbd72f0f000       0       0       0 ----- libpthread-2.24.so
00007fbd7310e000       4       4       4 r---- libpthread-2.24.so
00007fbd7310e000       0       0       0 r---- libpthread-2.24.so
00007fbd7310f000       4       4       4 rw--- libpthread-2.24.so
00007fbd7310f000       0       0       0 rw--- libpthread-2.24.so
00007fbd73110000      16       4       4 rw---   [ anon ]
00007fbd73110000       0       0       0 rw---   [ anon ]
00007fbd73114000     140     140       0 r-x-- ld-2.24.so
00007fbd73114000       0       0       0 r-x-- ld-2.24.so
00007fbd73231000     976     352     352 rw---   [ anon ]
00007fbd73231000       0       0       0 rw---   [ anon ]
00007fbd73326000      64       4       4 rw---   [ anon ]
00007fbd73326000       0       0       0 rw---   [ anon ]
00007fbd73336000       4       4       4 r---- ld-2.24.so
00007fbd73336000       0       0       0 r---- ld-2.24.so
00007fbd73337000       4       4       4 rw--- ld-2.24.so
00007fbd73337000       0       0       0 rw--- ld-2.24.so
00007fbd73338000       4       4       4 rw---   [ anon ]
00007fbd73338000       0       0       0 rw---   [ anon ]
00007fff95faf000     132      16      16 rw---   [ stack ]
00007fff95faf000       0       0       0 rw---   [ stack ]
00007fff95ff7000       8       0       0 r----   [ anon ]
00007fff95ff7000       0       0       0 r----   [ anon ]
00007fff95ff9000       8       4       0 r-x--   [ anon ]
00007fff95ff9000       0       0       0 r-x--   [ anon ]
ffffffffff600000       4       0       0 r-x--   [ anon ]
ffffffffff600000       0       0       0 r-x--   [ anon ]
---------------- ------- ------- -------
total kB          198292   11252    6768

Rust

vagrant@archlinux:~$ pmap -x `pgrep boom`
6637:   boom-rust -n 100000 -c 10 http://0.0.0.0:8889/
Address           Kbytes     RSS   Dirty Mode  Mapping
0000558f391dc000    1352    1232       0 r-x-- boom-rust
0000558f391dc000       0       0       0 r-x-- boom-rust
0000558f3952e000     432     428     428 r---- boom-rust
0000558f3952e000       0       0       0 r---- boom-rust
0000558f3959a000       4       4       4 rw--- boom-rust
0000558f3959a000       0       0       0 rw--- boom-rust
0000558f3959b000       4       4       4 rw---   [ anon ]
0000558f3959b000       0       0       0 rw---   [ anon ]
00007fb90da00000   36864   36864   36864 rw---   [ anon ]
00007fb90da00000       0       0       0 rw---   [ anon ]
00007fb90ffff000       4       0       0 -----   [ anon ]
00007fb90ffff000       0       0       0 -----   [ anon ]
00007fb910000000    4096    4096    4096 rw---   [ anon ]
00007fb910000000       0       0       0 rw---   [ anon ]
00007fb9105ff000       4       0       0 -----   [ anon ]
00007fb9105ff000       0       0       0 -----   [ anon ]
00007fb910600000    4096    4096    4096 rw---   [ anon ]
00007fb910600000       0       0       0 rw---   [ anon ]
00007fb910bff000       4       0       0 -----   [ anon ]
00007fb910bff000       0       0       0 -----   [ anon ]
00007fb910c00000   10240   10240   10240 rw---   [ anon ]
00007fb910c00000       0       0       0 rw---   [ anon ]
00007fb9117ff000       4       0       0 -----   [ anon ]
00007fb9117ff000       0       0       0 -----   [ anon ]
00007fb911800000    4096    4096    4096 rw---   [ anon ]
00007fb911800000       0       0       0 rw---   [ anon ]
00007fb911dfa000       4       0       0 -----   [ anon ]
00007fb911dfa000       0       0       0 -----   [ anon ]
00007fb911dfb000    2048      40      40 rw---   [ anon ]
00007fb911dfb000       0       0       0 rw---   [ anon ]
00007fb911ffb000       4       0       0 -----   [ anon ]
00007fb911ffb000       0       0       0 -----   [ anon ]
00007fb911ffc000    2048      40      40 rw---   [ anon ]
00007fb911ffc000       0       0       0 rw---   [ anon ]
00007fb9121fc000       4       0       0 -----   [ anon ]
00007fb9121fc000       0       0       0 -----   [ anon ]
00007fb9121fd000    2048      40      40 rw---   [ anon ]
00007fb9121fd000       0       0       0 rw---   [ anon ]
00007fb9123fd000       4       0       0 -----   [ anon ]
00007fb9123fd000       0       0       0 -----   [ anon ]
00007fb9123fe000    2048      40      40 rw---   [ anon ]
00007fb9123fe000       0       0       0 rw---   [ anon ]
00007fb9125fe000       4       0       0 -----   [ anon ]
00007fb9125fe000       0       0       0 -----   [ anon ]
00007fb9125ff000    2048      40      40 rw---   [ anon ]
00007fb9125ff000       0       0       0 rw---   [ anon ]
00007fb9127ff000       4       0       0 -----   [ anon ]
00007fb9127ff000       0       0       0 -----   [ anon ]
00007fb912800000    6144    6144    6144 rw---   [ anon ]
00007fb912800000       0       0       0 rw---   [ anon ]
00007fb912ea7000    1036     228       0 r-x-- libm-2.24.so
00007fb912ea7000       0       0       0 r-x-- libm-2.24.so
00007fb912faa000    2044       0       0 ----- libm-2.24.so
00007fb912faa000       0       0       0 ----- libm-2.24.so
00007fb9131a9000       4       4       4 r---- libm-2.24.so
00007fb9131a9000       0       0       0 r---- libm-2.24.so
00007fb9131aa000       4       4       4 rw--- libm-2.24.so
00007fb9131aa000       0       0       0 rw--- libm-2.24.so
00007fb9131ab000    1620    1352       0 r-x-- libc-2.24.so
00007fb9131ab000       0       0       0 r-x-- libc-2.24.so
00007fb913340000    2044       0       0 ----- libc-2.24.so
00007fb913340000       0       0       0 ----- libc-2.24.so
00007fb91353f000      16      16      16 r---- libc-2.24.so
00007fb91353f000       0       0       0 r---- libc-2.24.so
00007fb913543000       8       8       8 rw--- libc-2.24.so
00007fb913543000       0       0       0 rw--- libc-2.24.so
00007fb913545000      16      12      12 rw---   [ anon ]
00007fb913545000       0       0       0 rw---   [ anon ]
00007fb913549000      88      84       0 r-x-- libgcc_s.so.1
00007fb913549000       0       0       0 r-x-- libgcc_s.so.1
00007fb91355f000    2044       0       0 ----- libgcc_s.so.1
00007fb91355f000       0       0       0 ----- libgcc_s.so.1
00007fb91375e000       4       4       4 r---- libgcc_s.so.1
00007fb91375e000       0       0       0 r---- libgcc_s.so.1
00007fb91375f000       4       4       4 rw--- libgcc_s.so.1
00007fb91375f000       0       0       0 rw--- libgcc_s.so.1
00007fb913760000      96      96       0 r-x-- libpthread-2.24.so
00007fb913760000       0       0       0 r-x-- libpthread-2.24.so
00007fb913778000    2044       0       0 ----- libpthread-2.24.so
00007fb913778000       0       0       0 ----- libpthread-2.24.so
00007fb913977000       4       4       4 r---- libpthread-2.24.so
00007fb913977000       0       0       0 r---- libpthread-2.24.so
00007fb913978000       4       4       4 rw--- libpthread-2.24.so
00007fb913978000       0       0       0 rw--- libpthread-2.24.so
00007fb913979000      16       4       4 rw---   [ anon ]
00007fb913979000       0       0       0 rw---   [ anon ]
00007fb91397d000       8       8       0 r-x-- libdl-2.24.so
00007fb91397d000       0       0       0 r-x-- libdl-2.24.so
00007fb91397f000    2048       0       0 ----- libdl-2.24.so
00007fb91397f000       0       0       0 ----- libdl-2.24.so
00007fb913b7f000       4       4       4 r---- libdl-2.24.so
00007fb913b7f000       0       0       0 r---- libdl-2.24.so
00007fb913b80000       4       4       4 rw--- libdl-2.24.so
00007fb913b80000       0       0       0 rw--- libdl-2.24.so
00007fb913b81000    2352    1576       0 r-x-- libcrypto.so.1.0.0
00007fb913b81000       0       0       0 r-x-- libcrypto.so.1.0.0
00007fb913dcd000    2048       0       0 ----- libcrypto.so.1.0.0
00007fb913dcd000       0       0       0 ----- libcrypto.so.1.0.0
00007fb913fcd000     112     112     112 r---- libcrypto.so.1.0.0
00007fb913fcd000       0       0       0 r---- libcrypto.so.1.0.0
00007fb913fe9000      48      48      48 rw--- libcrypto.so.1.0.0
00007fb913fe9000       0       0       0 rw--- libcrypto.so.1.0.0
00007fb913ff5000      12      12      12 rw---   [ anon ]
00007fb913ff5000       0       0       0 rw---   [ anon ]
00007fb913ff8000     408     404       0 r-x-- libssl.so.1.0.0
00007fb913ff8000       0       0       0 r-x-- libssl.so.1.0.0
00007fb91405e000    2048       0       0 ----- libssl.so.1.0.0
00007fb91405e000       0       0       0 ----- libssl.so.1.0.0
00007fb91425e000      16      16      16 r---- libssl.so.1.0.0
00007fb91425e000       0       0       0 r---- libssl.so.1.0.0
00007fb914262000      28      28      28 rw--- libssl.so.1.0.0
00007fb914262000       0       0       0 rw--- libssl.so.1.0.0
00007fb914269000     140     140       0 r-x-- ld-2.24.so
00007fb914269000       0       0       0 r-x-- ld-2.24.so
00007fb91446d000      52      24      24 rw---   [ anon ]
00007fb91446d000       0       0       0 rw---   [ anon ]
00007fb91447b000      64       0       0 rw---   [ anon ]
00007fb91447b000       0       0       0 rw---   [ anon ]
00007fb91448b000       4       4       4 r---- ld-2.24.so
00007fb91448b000       0       0       0 r---- ld-2.24.so
00007fb91448c000       4       4       4 rw--- ld-2.24.so
00007fb91448c000       0       0       0 rw--- ld-2.24.so
00007fb91448d000       4       4       4 rw---   [ anon ]
00007fb91448d000       0       0       0 rw---   [ anon ]
00007ffc8ccab000       4       0       0 -----   [ anon ]
00007ffc8ccab000       0       0       0 -----   [ anon ]
00007ffc8d48a000     132      24      24 rw---   [ stack ]
00007ffc8d48a000       0       0       0 rw---   [ stack ]
00007ffc8d566000       8       0       0 r----   [ anon ]
00007ffc8d566000       0       0       0 r----   [ anon ]
00007ffc8d568000       8       4       0 r-x--   [ anon ]
00007ffc8d568000       0       0       0 r-x--   [ anon ]
ffffffffff600000       4       0       0 r-x--   [ anon ]
ffffffffff600000       0       0       0 r-x--   [ anon ]
---------------- ------- ------- -------
total kB           98264   71644   66520

当然ですがどちらも前述の計測結果と変わらないですね。 Rustのメモリ消費量が多い理由が少しだけ垣間見えています。 00007fb90da00000 ~ 00007fb912800000 まで軒並みメモリ確保分RSS使っちゃってるように見えます。

完全にトレースできたわけではないので推察ですが、Rustはスレッド起動時にmmapでメモリ確保しているようで、 boom-rustの作り上 -c オプション数分 std::thread::spawn するので、それでメモリ消費量が多くなっているのではないかと。

GoとRustで Hello world だけ表示する最小限のプログラムでもRustの方が実消費メモリが大きいという結果になっていました。 プログラムのエントリポイントであるmain関数も1スレッド換算なので、 その際のメモリ確保分がのっているのではないのかなぁという。 この辺りは若干怪しいのでどこかで追試はしたいです。

valgrindによるメモリ使用量の計測

次は valgrind --tool=massif でメモリ消費量を確認します。

ヒープメモリ使用量(Go)

--------------------------------------------------------------------------------
Command:            /home/vagrant/.golang/bin/boom -n 1000 -c 10 http://0.0.0.0:8889/
Massif arguments:   --pages-as-heap=yes --time-unit=B
ms_print arguments: massif.out.6769
--------------------------------------------------------------------------------


    MB
319.0^                                                                ::::::
     |                                                                :
     |                                                                :
     |                                                                :
     |                                                                :     #@
     |                                               ::::::           :     #@
     |                                 ::::::        :                :     #@
     |                                 :             :                :     #@
     |                                 :             :                :     #@
     |                                 :      ::::::::     @:::::::::::     #@
     |               ::                :     @::     :     @          :     #@
     |               : @:::            :     @::     :     @          :     #@
     |               : @               :     @::     :     @          :     #@
     |               : @               :     @::     :     @          :     #@
     |               : @   :::::::::::::     @::     :     @          :     #@
     |               : @   ::          :     @::     :     @          :     #@
     |               : @   ::          :     @::     :     @          :     #@
     |               : @   ::          :     @::     :     @          :     #@
     |   @:::::::::::: @   ::          :     @::     :     @          :     #@
     |  :@           : @   ::          :     @::     :     @          :     #@
   0 +----------------------------------------------------------------------->MB
     0                                                                   779.7

Number of snapshots: 71
 Detailed snapshots: [9, 12, 22, 26, 30, 40, 43, 50, 56, 59 (peak), 69]

ヒープメモリ使用量(Rust)

--------------------------------------------------------------------------------
Command:            boom-rust -n 1000 -c 10 http://0.0.0.0:8889/
Massif arguments:   --pages-as-heap=yes --time-unit=B
ms_print arguments: massif.out.6783
--------------------------------------------------------------------------------


    MB
64.13^                                                         #
     |                                                        :#::
     |                                                     ::::# ::::
     |                                                   :::: :# ::: :
     |                                              : :::: :: :# ::: ::::
     |                                         ::   ::: :: :: :# ::: :: :::
     |                                      :::: :::::: :: :: :# ::: :: :: :@
     |                                   :::: :: :  ::: :: :: :# ::: :: :: :@:
     |                                  :: :: :: :  ::: :: :: :# ::: :: :: :@:
     |                               ::@:: :: :: :  ::: :: :: :# ::: :: :: :@:
     |                              :: @:: :: :: :  ::: :: :: :# ::: :: :: :@:
     |                           ::::: @:: :: :: :  ::: :: :: :# ::: :: :: :@:
     |                  ::   :::::: :: @:: :: :: :  ::: :: :: :# ::: :: :: :@:
     |                 :: :::::: :: :: @:: :: :: :  ::: :: :: :# ::: :: :: :@:
     |               :::: :  ::: :: :: @:: :: :: :  ::: :: :: :# ::: :: :: :@:
     |            :::: :: :  ::: :: :: @:: :: :: :  ::: :: :: :# ::: :: :: :@:
     |         ::::  : :: :  ::: :: :: @:: :: :: :  ::: :: :: :# ::: :: :: :@:
     |       :::: :  : :: :  ::: :: :: @:: :: :: :  ::: :: :: :# ::: :: :: :@:
     |    :::: :: :  : :: :  ::: :: :: @:: :: :: :  ::: :: :: :# ::: :: :: :@:
     |  :::  : :: :  : :: :  ::: :: :: @:: :: :: :  ::: :: :: :# ::: :: :: :@:
   0 +----------------------------------------------------------------------->MB
     0                                                                   100.4

Number of snapshots: 54
 Detailed snapshots: [26, 42 (peak), 52]

スタックメモリ使用量(Go)

--------------------------------------------------------------------------------
Command:            /home/vagrant/.golang/bin/boom -n 1000 -c 10 http://0.0.0.0:8889/
Massif arguments:   --stacks=yes --time-unit=B
ms_print arguments: massif.out.6845
--------------------------------------------------------------------------------


    MB
1.045^                                                                       :
     |                                                                  :@@##:
     |                                                               ::@:@ # :
     |                                                            :@@: @:@ # :
     |                                                        @:@@:@ : @:@ # :
     |                                                    :@@@@:@ :@ : @:@ # :
     |                                                 ::::@@ @:@ :@ : @:@ # :
     |                                            @@@@@: ::@@ @:@ :@ : @:@ # :
     |                                         :::@ @@ : ::@@ @:@ :@ : @:@ # :
     |                                      @@@: :@ @@ : ::@@ @:@ :@ : @:@ # :
     |                                  @@::@ @: :@ @@ : ::@@ @:@ :@ : @:@ # :
     |                              @@::@@: @ @: :@ @@ : ::@@ @:@ :@ : @:@ # :
     |                          :@@@@ : @@: @ @: :@ @@ : ::@@ @:@ :@ : @:@ # :
     |                       @@::@ @@ : @@: @ @: :@ @@ : ::@@ @:@ :@ : @:@ # :
     |                     @@@ ::@ @@ : @@: @ @: :@ @@ : ::@@ @:@ :@ : @:@ # :
     |                 @@::@@@ ::@ @@ : @@: @ @: :@ @@ : ::@@ @:@ :@ : @:@ # :
     |             :@::@ : @@@ ::@ @@ : @@: @ @: :@ @@ : ::@@ @:@ :@ : @:@ # :
     |          :@@:@: @ : @@@ ::@ @@ : @@: @ @: :@ @@ : ::@@ @:@ :@ : @:@ # :
     |       @:::@ :@: @ : @@@ ::@ @@ : @@: @ @: :@ @@ : ::@@ @:@ :@ : @:@ # :
     |     @@@: :@ :@: @ : @@@ ::@ @@ : @@: @ @: :@ @@ : ::@@ @:@ :@ : @:@ # :
   0 +----------------------------------------------------------------------->MB
     0                                                                   225.3

Number of snapshots: 50
 Detailed snapshots: [3, 4, 5, 8, 10, 12, 14, 15, 16, 19, 20, 21, 23, 24, 26, 27, 30, 31, 32, 36, 37, 38, 40, 42, 44, 46, 48 (peak)]

スタックメモリ使用量(Rust)

--------------------------------------------------------------------------------
Command:            boom-rust -n 1000 -c 10 http://0.0.0.0:8889/
Massif arguments:   --stacks=yes --time-unit=B
ms_print arguments: massif.out.6826
--------------------------------------------------------------------------------


    KB
333.8^                ##
     |                #
     |                # :::  :::::: ::: :: @ :: :: @:::@    @: :
     |                # ::::::: :::::::@:::@:::::::@:::@::::@::: ::
     |                # :::: :: :::::::@:::@:::::::@:::@::::@:::::::@::
     |                # :::: :: :::::::@:::@:::::::@:::@::::@:::::::@::
     |                # :::: :: :::::::@:::@:::::::@:::@::::@:::::::@::
     |                # :::: :: :::::::@:::@:::::::@:::@::::@:::::::@:::
     |                # :::: :: :::::::@:::@:::::::@:::@::::@:::::::@:::
     |                # :::: :: :::::::@:::@:::::::@:::@::::@:::::::@:::
     |                # :::: :: :::::::@:::@:::::::@:::@::::@:::::::@:::
     |                # :::: :: :::::::@:::@:::::::@:::@::::@:::::::@:::::
     |                # :::: :: :::::::@:::@:::::::@:::@::::@:::::::@:::::
     |                # :::: :: :::::::@:::@:::::::@:::@::::@:::::::@:::::
     |                # :::: :: :::::::@:::@:::::::@:::@::::@:::::::@:::::
     |                # :::: :: :::::::@:::@:::::::@:::@::::@:::::::@:::::
     |                # :::: :: :::::::@:::@:::::::@:::@::::@:::::::@::::::
     |                # :::: :: :::::::@:::@:::::::@:::@::::@:::::::@::::::
     |                # :::: :: :::::::@:::@:::::::@:::@::::@:::::::@::::::
     |             @  # :::: :: :::::::@:::@:::::::@:::@::::@:::::::@:::::::
   0 +----------------------------------------------------------------------->MB
     0                                                                   378.8

Number of snapshots: 76
 Detailed snapshots: [12, 15, 16 (peak), 30, 34, 43, 47, 53, 63, 73]

プログラム側(ランタイム以外)だけでみるとRustのほうがメモリフットプリント少ないということでいいのかな?

valgrindによるメモリリークチェック

最後はvalgrindでのメモリリークチェック。 (Go版でリーク検出されまくったのでリクエスト数を少し減らしています。)

valgrind --leak-check=full で動かしてみます(Go)

==6687== Memcheck, a memory error detector
==6687== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==6687== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==6687== Command: boom -n 1000 -c 10 http://0.0.0.0:8889/
==6687==
==6687== Warning: ignored attempt to set SIGRT32 handler in sigaction();
==6687==          the SIGRT32 signal is used internally by Valgrind
==6687== Warning: client switching stacks?  SP change: 0xfff000440 --> 0xc4200267b8
==6687==          to suppress, use: --max-stackframe=773647917944 or greater
==6687== Warning: client switching stacks?  SP change: 0xc420026760 --> 0xfff0004a8
==6687==          to suppress, use: --max-stackframe=773647917752 or greater
==6687== Warning: client switching stacks?  SP change: 0xfff0004a8 --> 0xc420026760
==6687==          to suppress, use: --max-stackframe=773647917752 or greater
==6687==          further instances of this message will not be shown.
==6687== Thread 3:
==6687== Conditional jump or move depends on uninitialised value(s)
==6687==    at 0x4416C5: ??? (in /home/vagrant/.golang/bin/boom)
==6687==    by 0x44A9CB: ??? (in /home/vagrant/.golang/bin/boom)
==6687==    by 0x442530: ??? (in /home/vagrant/.golang/bin/boom)
==6687==    by 0x4429EF: ??? (in /home/vagrant/.golang/bin/boom)
==6687==    by 0x45781E: ??? (in /home/vagrant/.golang/bin/boom)
==6687==    by 0xC42001F4FF: ???
==6687==
==6687== Conditional jump or move depends on uninitialised value(s)
==6687==    at 0x4416CE: ??? (in /home/vagrant/.golang/bin/boom)
==6687==    by 0x44A9CB: ??? (in /home/vagrant/.golang/bin/boom)
==6687==    by 0x442530: ??? (in /home/vagrant/.golang/bin/boom)
==6687==    by 0x4429EF: ??? (in /home/vagrant/.golang/bin/boom)
==6687==    by 0x45781E: ??? (in /home/vagrant/.golang/bin/boom)
==6687==    by 0xC42001F4FF: ???
==6687==
==6687== Thread 6:
==6687== Invalid write of size 8
==6687==    at 0x45AE6E: ??? (in /home/vagrant/.golang/bin/boom)
==6687==    by 0x4429EF: ??? (in /home/vagrant/.golang/bin/boom)
==6687==    by 0x45781E: ??? (in /home/vagrant/.golang/bin/boom)
==6687==    by 0xC42001F4FF: ???
==6687==  Address 0xc4200492a8 is in a rw- anonymous segment
==6687==
==6687== Invalid read of size 8
==6687==    at 0x44AB51: ??? (in /home/vagrant/.golang/bin/boom)
==6687==    by 0x442530: ??? (in /home/vagrant/.golang/bin/boom)
==6687==    by 0x4429EF: ??? (in /home/vagrant/.golang/bin/boom)
==6687==    by 0x45781E: ??? (in /home/vagrant/.golang/bin/boom)
==6687==    by 0xC42001F4FF: ???
==6687==  Address 0xc4200492a8 is in a rw- anonymous segment
  :
==6687== 1,728 bytes in 6 blocks are possibly lost in loss record 6 of 6
==6687==    at 0x4C2BA4A: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6687==    by 0x4011B91: allocate_dtv (in /usr/lib/ld-2.24.so)
==6687==    by 0x401251D: _dl_allocate_tls (in /usr/lib/ld-2.24.so)
==6687==    by 0x4E3CFE9: pthread_create@@GLIBC_2.2.5 (in /usr/lib/libpthread-2.24.so)
==6687==    by 0x61408E: ??? (in /home/vagrant/.golang/bin/boom)
==6687==    by 0x4037FFF: ???
==6687==
==6687== LEAK SUMMARY:
==6687==    definitely lost: 0 bytes in 0 blocks
==6687==    indirectly lost: 0 bytes in 0 blocks
==6687==      possibly lost: 4,608 bytes in 16 blocks
==6687==    still reachable: 0 bytes in 0 blocks
==6687==         suppressed: 0 bytes in 0 blocks
==6687==
==6687== For counts of detected and suppressed errors, rerun with: -v
==6687== Use --track-origins=yes to see where uninitialised values come from
==6687== ERROR SUMMARY: 5021 errors from 1006 contexts (suppressed: 0 from 0)

数え切れないほどのリークが... 実害はないのかもしれませんが...

続いてRust

==6715== Memcheck, a memory error detector
==6715== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==6715== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==6715== Command: boom-rust -n 1000 -c 10 http://0.0.0.0:8889/
==6715==
==6715== Thread 4:
==6715== Conditional jump or move depends on uninitialised value(s)
==6715==    at 0x167D45: boom_rust::exec_worker::h6f626776ca28873e (in /home/vagrant/.cargo/bin/boom-rust)
==6715==    by 0x17CE92: std::panicking::try::call::ha53553db2afcbd92 (in /home/vagrant/.cargo/bin/boom-rust)
==6715==    by 0x1DAB3B: __rust_try (in /home/vagrant/.cargo/bin/boom-rust)
==6715==    by 0x1DAADE: __rust_maybe_catch_panic (in /home/vagrant/.cargo/bin/boom-rust)
==6715==    by 0x17D2BC: _$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$::call_box::hfcb24259680cab92 (in /home/vagrant/.cargo/bin/boom-rust)
==6715==    by 0x1D3794: std::sys::thread::Thread::new::thread_start::hf2eed4b6f7149599 (in /home/vagrant/.cargo/bin/boom-rust)
==6715==    by 0x5728453: start_thread (in /usr/lib/libpthread-2.24.so)
==6715==    by 0x5C3D7DE: clone (in /usr/lib/libc-2.24.so)
==6715==
Summary:
  Total:        1.26429 s
  Slowest:      0.15251 s
  Fastest:      0.00056 s
  Average:      0.00864 s
  Requests/sec: 790.96
  Total data:   11000 bytes
  Size/request: 11 bytes

Status code distribution:
  [200] 1000 responses

Response time histogram:
  0.001 [172]       |*********
  0.016 [702]       |****************************************
  0.031 [32]        |*
  0.046 [59]        |***
  0.061 [15]        |
  0.077 [6] |
  0.092 [4] |
  0.107 [5] |
  0.122 [1] |
  0.137 [2] |
  0.153 [2] |

Latency distribution:
  25% in 0.0010 secs
  50% in 0.0010 secs
  75% in 0.0070 secs
  90% in 0.0280 secs
  95% in 0.0400 secs
  99% in 0.0950 secs
==6715==
==6715== HEAP SUMMARY:
==6715==     in use at exit: 0 bytes in 0 blocks
==6715==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==6715==
==6715== All heap blocks were freed -- no leaks are possible
==6715==
==6715== For counts of detected and suppressed errors, rerun with: -v
==6715== Use --track-origins=yes to see where uninitialised values come from
==6715== ERROR SUMMARY: 1010 errors from 1 contexts (suppressed: 0 from 0)

リークなし!!

パフォーマンス計測はここまでです。 Rust良い、という感触を得ました。

最後に

みんなもRust使ってこ