I'm seeing some concurrency problems in a library I'm using that implements Celluloid actors. Out of curiosity, I ran the benchmarking script in Celluloid with a couple different interpreters.
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 using 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 using 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
If I am reading this correctly, the 1.9 and 2.1 interpreters are spawning more actors than when run in JRuby. I would have expected JRuby to spawn more actors and to run faster than either of the C interpreters - but that does not seem to be the case.
Is there something missing in the way I'm running the benchmarks, or is there some difficulty in Celluloid in launching a large number of actors?
EDIT I originally used the wrong settings to compile AOT. The numbers now appear even lower for AOT - albeit I did not specify any other options besides compilation.