Skip to content

Instantly share code, notes, and snippets.

@headius
Created December 18, 2011 16:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headius/1493911 to your computer and use it in GitHub Desktop.
Save headius/1493911 to your computer and use it in GitHub Desktop.
Latest red/black tree benchmark results on Java 7, with and without invokedynamic
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
@jfbaro
Copy link

jfbaro commented Dec 20, 2011

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!

@lest
Copy link

lest commented Dec 21, 2011

Could you run benchmark on MRI 1.9.3 to compare?

@headius
Copy link
Author

headius commented Dec 21, 2011

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.

@lest
Copy link

lest commented Dec 21, 2011

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

@headius
Copy link
Author

headius commented Dec 21, 2011

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment