public
Created

Latest red/black tree benchmark results on Java 7, with and without invokedynamic

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
system ~/projects/jruby $ jruby -v bench/bench_red_black.rb
jruby 1.7.0.dev (ruby-1.8.7-p352) (2011-12-18 43cbc21) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java]
2.748
1.902
1.87
1.877
1.873
1.868
1.864
1.876
1.884
1.886
 
system ~/projects/jruby $ pickjdk 5
New JDK: 1.7.0u.jdk
 
system ~/projects/jruby $ jruby -v -Xcompile.invokedynamic=false bench/bench_red_black.rb
jruby 1.7.0.dev (ruby-1.8.7-p352) (2011-12-18 43cbc21) (OpenJDK 64-Bit Server VM 1.7.0-u2-b21) [darwin-amd64-java]
2.367
1.415
1.378
1.522
1.416
1.395
1.405
1.416
1.415
1.395
 
system ~/projects/jruby $ jruby -v bench/bench_red_black.rb
jruby 1.7.0.dev (ruby-1.8.7-p352) (2011-12-18 43cbc21) (OpenJDK 64-Bit Server VM 1.7.0-u2-b21) [darwin-amd64-java]
3.225
1.064
0.792
0.728
1.333
1.005
0.677
0.687
0.673
0.679
 
system ~/projects/jruby $ rvm 1.9.3 do ruby bench/bench_red_black.rb
3.426258
3.415173
3.475542
3.497635
3.43508
3.491093
3.413686
3.542578
3.437846
3.626295

Wow! Great stuff! Congratulations!

Just one question though, why is the first number slower in the latest version?

jruby 1.7.0.dev - VM 1.6.0_29 -> 2.748
jruby 1.7.0.dev - VM 1.7.0-u2-b21 -> 2.367
jruby 1.7.0.dev - VM 1.7.0-u2-b21-> 3.225 **

What are the next big steps in order to improve JRuby even more?

Great work!

Could you run benchmark on MRI 1.9.3 to compare?

jfbaro: One of the remaining work areas for invokedynamic in OpenJDK is its performance when it hasn't been JIT compiled by the JVM. Currently, JRuby + invokedynamic can be considerably slower when "cold". This is the effect you see above. Obviously we make up for it when the JIT kicks in, but the JVM guys have more work to do on cold and unoptimized performance.

The next big steps for JRuby involve using invokedynamic more and more and reducing the amount of object overhead we require for normal execution (e.g. closures that have heap-based scopes, etc). There's a lot of room to improve.

lest: I will update the benchmark with 1.9.3's numbers in the next few minutes.

Is JRuby faster that MRI in general or there are some cases where MRI wins?

There will always be cases where we win or where we lose. Java 7's features have made the win cases more frequent and more impressive. In general if we are slower we consider it a bug and would like bug reports.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.