Sit back, relax, and enjoy the code.

Playing with JRuby, Part 1A

Posted: February 18th, 2009 | Author: Brad | Filed under: Programming | Tags: , , | Comments Off

First, thanks to Lopex, Charles/Headius, and Thomas for their well-coordinated effort to alleviate some of my JRuby ignorance in my earlier post. And for not going out of their way to make fun of my janky “benchmarks” – like I said, those weren’t meant to be real benchmarks, just something to give me an idea of relative performance with some operations I care about.

In that same spirit, I took Lopex’s advice and turned on the –server flag; performance gain went from almost 2-to-1 to almost 3-to-1, with no other changes or optimizations.

Before:

[~/project/jrubytest/primes]> ruby ./primes.rb
FINDING first 100000 PRIMES
1299709
Time: 57.716853s
[~/project/jrubytest/primes]> jruby ./primes.rb
FINDING first 100000 PRIMES
1299709
Time: 33.885273s

After:

[~/project/jrubytest/primes]> ruby primes.rb
FINDING first 100000 PRIMES
1299709
Time: 57.204178s
[~/project/jrubytest/primes]> jruby --server primes.rb
FINDING first 100000 PRIMES
1299709
Time: 21.067204s

Thanks to the JRuby crew for stopping by here, and for being so helpful generally.

  • Share/Bookmark

Playing with JRuby, Part 1

Posted: February 16th, 2009 | Author: Brad | Filed under: Programming | Tags: , , | 8 Comments »

As part of a new project, I’m experimenting with JRuby, to see (a) if the alleged performance gains are all that and (b) see how far the Java integration – especially interface implementation – can be pushed.

On the performance front, I did a quick-and-dirty test with a CPU-expensive script that finds prime numbers – not a real benchmark, but something to give me an idea of how JRuby held up under a steady load of basic math operations. Details follow.

Read the rest of this entry »

  • Share/Bookmark