难以在JRuby中实现赛璐珞基准测试

时间:2014-04-18 13:28:13

标签: ruby concurrency jvm actor celluloid

我在库中看到了一些并发问题,我使用它实现了Celluloid actor。出于好奇,我在Celluloid中用the benchmarking script运行了几个不同的口译员。

Ruby 1.9.3

Calculating -------------------------------------
               spawn       387 i/100ms
               calls       757 i/100ms
         async calls       431 i/100ms
            messages      3063 i/100ms
-------------------------------------------------
               spawn     3957.4 (±3.9%) i/s -      20124 in   5.093148s
               calls     8054.8 (±5.8%) i/s -      40878 in   5.092786s
         async calls    15709.4 (±11.0%) i/s -      77580 in   5.008169s
            messages   497844.7 (±16.0%) i/s -    2383014 in   4.989021s

Ruby 2.1.1

Calculating -------------------------------------
               spawn       359 i/100ms
               calls       749 i/100ms
         async calls       383 i/100ms
            messages      3579 i/100ms
-------------------------------------------------
               spawn     3823.2 (±8.1%) i/s -      19027 in   5.011383s
               calls     8205.4 (±7.3%) i/s -      41195 in   5.049513s
         async calls    14086.1 (±8.7%) i/s -      70089 in   5.016073s
            messages   766163.5 (±19.8%) i/s -    3510999 in   4.993806s

JRuby 1.7.11使用JIT

Calculating -------------------------------------
               spawn        75 i/100ms
               calls       294 i/100ms
         async calls       154 i/100ms
            messages      4548 i/100ms
-------------------------------------------------
               spawn     2521.8 (±24.3%) i/s -      11625 in   4.999000s
               calls     8207.7 (±25.3%) i/s -      37632 in   5.049000s
         async calls     9001.3 (±30.2%) i/s -      36652 in   4.971000s
            messages   334366.4 (±14.7%) i/s -    1619088 in   4.999000s

JRuby 1.7.11使用AOT

Calculating -------------------------------------
               spawn        88 i/100ms
               calls       324 i/100ms
         async calls       126 i/100ms
            messages      2576 i/100ms
-------------------------------------------------
               spawn     2198.8 (±25.5%) i/s -       9416 in   5.004000s
               calls     6188.9 (±21.5%) i/s -      29160 in   5.014000s
         async calls     6906.6 (±26.3%) i/s -      29862 in   4.996000s
            messages   198558.0 (±20.3%) i/s -     922208 in   4.995000s

如果我正确地阅读此内容,1.9和2.1解释器产生的演员数量多于在JRuby中运行时的演员数量。我原本期望JRuby能够产生更多的演员,并且比任何一个C语言解释器运行得更快 - 但事实似乎并非如此。

我运行基准测试的方式是否缺少某些东西,或者Celluloid在启动大量演员方面有些困难?

编辑我最初使用了错误的设置来编译AOT。现在AOT的数字显得更低 - 虽然除了编译之外我没有指定任何其他选项。

0 个答案:

没有答案