Ruby vs Rubinius vs GobiesVM
I benchmark GobiesVM compared with Ruby and rubinius.
Rubykaigi2014で紹介されていたGobiesVMを使って、ベンチ取ってみた。
Machine Specs
% system_profiler SPHardwareDataType Hardware: Hardware Overview: Model Name: MacBook Air Model Identifier: MacBookAir6,1 Processor Name: Intel Core i5 Processor Speed: 1.3 GHz Number of Processors: 1 Total Number of Cores: 2 L2 Cache (per Core): 256 KB L3 Cache: 3 MB Memory: 8 GB % sysctl machdep.cpu.brand_string machdep.cpu.brand_string: Intel(R) Core(TM) i5-4250U CPU @ 1.30GHz
CPU spec ARK | Intel® Core™ i5-4250U Processor (3M Cache, up to 2.60 GHz)
- 2 physical CPUs and four vCPUs
- 物理CPUが2個、仮想CPUが4個
benchmark
ResultのCPU利用率は、赤がsystem、緑がuserです。
仮想CPUが4個なので、4つグラフが出ています。
Ruby
Version
% ruby -v ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin12.0]
Script
Result
% ruby tests/pi_ruby.rb 3.142525 user system total real 0.360000 0.410000 0.770000 ( 0.592886)
- CPU history
Rubinius
Version
% rbx -v rubinius 2.2.10 (2.1.0 bf61ae2e 2014-06-27 JI) [x86_64-darwin13.3.0]```
Script
Same as Ruby.
Result
% rbx tests/pi_ruby.rb 3.139975 user system total real 1.610529 1.469658 3.080187 ( 1.868355)
- CPU history
GobiesVM
Version
Script
GobiesVM/pi.rb at fe25fbb08701c8e5187372e9e4c689b6c34ecd3c · brucehsu/GobiesVM · GitHub
Result
% bin/gobiesvm -bench=1 tests/pi.rb 3.147900000000 Total time in 1 iterations: 19.521622038 s Average Time in 1 iterations: 19.521622038 s
- CPU history
まとめ
GobiesVMはCPU使い切ってる感ありますが、いかんせんまだまだパフォーマンスが追いついていない印象ですね。
RubyとかRubiniusは、物理CPU一個を使っている感じですかね。
systemのCPU使用率が高いのは、コンテキストスイッチが発生しているからと思われます。