What I learned from Charles Nutter about JRuby

The acts_as_conference has passed and was a great time to relax and learn some things related to Ruby. One of talks I was looking forward to was the talk about JRuby from Charles Nutter. I was aware of the JRuby project but never really paid close attention to it but with Mr. JRuby himself going to talk about it, I wanted to listen.

When I thought of JRuby I thought of Java and I am not a Java programmer, so JRuby must not be for me. Charles said he heard this reason many times and he said:

Not liking JRuby because it is written in Java is like not liking Ruby because it is written in C.

It may seem obvious, but I never thought of it that way before.

JRuby Performance Information

One of the more interesting pieces of information Charles provided was that of the different versions of JRuby and how they related to

JRuby 1.0 was 2x slower than Ruby 1.8.6

JRuby 1.1 Beta1 2x faster than Ruby 1.8.6

JRuby trunk 2-5x faster and often faster than 1.9

Performance improvements in trunk due to a JIT compiler implementation. This looks like a huge boost for JRuby and really makes one think about running Ruby in this runtime over native Ruby 1.8.6.

JRuby Performance Demonstration

There has been a ton of performance-related bits of information posted on the web lately pertaining to Ruby vs. JRuby vs. other implementations. These are sometimes hard to get your head around and relate to. I anticipated Charles would simply gives us some performance numbers from previous tests but he instead run some live tests against different Ruby implementations he had on his laptop.

Three different types of tests were run, live for us to witness:

Method Dispatch (10 million invocations)

Ruby 1.8.6 ~2.1 secs

Ruby 1.9 ~0.95 secs

JRuby trunk 1.29 secs for first call and then 0.6 secs (JRuby trunk on Soy Latte)

Fibonacci

Ruby 1.9 0.4 secs

Ruby 1.8.6 ~1.54 secs

JRuby ~.77 secs first, 0.4 secs subsequently

Hilbert Matrix of Dimension 2, 4, … 64 times its inverse

Ruby 1.9 ~21secs

JRuby ~21secs

These numbers are really encouraging and well beyond what I expected. This information alone gives good reason for me to look deeper at using JRuby as a Ruby implementation I can use for some Rails applications I have running today.

Sun had a good presence at the conference and they seem committed to making Ruby successful on the Java JVM. They have already converted some of their web sites to run Ruby on Rails on JRuby and they are looking for people to use JRuby and talk about it. The NetBeans IDE was created by a group at Sun as well. This is a great IDE for Ruby development and overall project development.

The talk by Charles really made me more aware of JRuby and convinced me to try it out in conjunction with NetBeans as an IDE on my Windows or Mac machines.

Share this:

Comments

Good summary! As you have seen, JRuby’s only real downside at this point is its lethargic start-up time compared to MRI, but if you’re running persistent applications (Rails applications, say) there are some big wins to be had.

Good summary! As you have seen, JRuby’s only real downside at this point is its lethargic start-up time compared to MRI, but if you’re running persistent applications (Rails applications, say) there are some big wins to be had.

For me, JRuby was my opportunity to sneak Ruby into my workplace. We’re already a Java shop so it was very little to work to get a Rails up and running. The ‘ol code first and ask for forgiveness later… And what did it get me? The company paid my way to AAC; score.

NetBeans is definitely the Ruby IDE of choice if you’re on Windows, only because of the lack of a decent editor (there are some good TextMate clones out there but they’re expensive). It’s almost worth it for the debugging features alone if you can get around the bloat of running an IDE completely written in Java (and honestly, it’s not that bad).

Excellent write up. I attended acts_as_conference as well (my set of photos http://www.flickr.com/photos/mdweezer/sets/72157603876433161/) and I really enjoyed the JRuby talk as well. For me, JRuby was my opportunity to sneak Ruby into my workplace. We’re already a Java shop so it was very little to work to get a Rails up and running. The ‘ol code first and ask for forgiveness later… And what did it get me? The company paid my way to AAC; score. NetBeans is definitely the Ruby IDE of choice if you’re on Windows, only because of the lack of a decent editor (there are some good TextMate clones out there but they’re expensive). It’s almost worth it for the debugging features alone if you can get around the bloat of running an IDE completely written in Java (and honestly, it’s not that bad).

@Peter Thank you. Yes, I probably should have made the startup a point of concern but I just wanted to discuss the opening of my eyes to JRuby. I think keeping JRuby running is definitely a win for Ruby apps running on this implementation.

@Peter Thank you. Yes, I probably should have made the startup a point of concern but I just wanted to discuss the opening of my eyes to JRuby. I think keeping JRuby running is definitely a win for Ruby apps running on this implementation.

@Matthew Thank you. Great set of photos, you take better ones than I do. I think I recall you sitting on the opposite side of the room from me snapping pictures.

Great to hear you are getting Rails in to your company this way. I think JRuby is a perfect fit for this situation. I also feel IronRuby will do the same for the .NET side of things.

NetBeans is nice because is the same on Mac and Windows. I am coming from a .NET background so I am spoiled by Visual Studio. NetBeans offers its own intellisense which is often nice. I know the diehard Rails developers say you don’t need this, but it is nice to have. I use TextMate as well but NetBeans is cool.

@Matthew Thank you. Great set of photos, you take better ones than I do. I think I recall you sitting on the opposite side of the room from me snapping pictures. Great to hear you are getting Rails in to your company this way. I think JRuby is a perfect fit for this situation. I also feel IronRuby will do the same for the .NET side of things. NetBeans is nice because is the same on Mac and Windows. I am coming from a .NET background so I am spoiled by Visual Studio. NetBeans offers its own intellisense which is often nice. I know the diehard Rails developers say you don’t need this, but it is nice to have. I use TextMate as well but NetBeans is cool.

@Arun Understood. I knew you didn’t need to know Java to write Rails apps but I was under the impression that I may need to deal with some of the configuration issues Java developers face. I am glad to know otherwise.

@Arun Understood. I knew you didn’t need to know Java to write Rails apps but I was under the impression that I may need to deal with some of the configuration issues Java developers face. I am glad to know otherwise. Thanks for the links.