There's some benchmarking guidelines here: http://kenai.com/projects/jruby/pages/Benchmarks
That page is a little slow right now (Kenai problems) but the key thing you're missing here is running the JVM in "server" mode. You can do that by passing --server to JRuby or by setting env var JAVA_OPTS="- server". The mixed mode or "client" VM you ran your benchmark with is anywhere from 50-100% slower than running in server mode for CPU- intensive algorithms. Turning server mode on also switches to a different garbage collector that emphasizes collection speed, parallelism, and/or reduced pauses over raw throughput. In short, if JRuby is slower than MRI for some task: * Make sure you're running the JVM in server mode * Make sure you're running enough iterations of your benchmark (minutes should be plenty long) And if it's still slow, it's either a bottleneck in JRuby or a bottleneck in some library, and those can usually be fixed. Have fun! On Apr 23, 2:57 pm, Michael Lang <[email protected]> wrote: > One of the things I've been hearing about is jruby well outperforming ruby > mri. > > Today, I got jruby + jdbc + sequel working on my mac and took things for a > twirl on connecting Sequel to MSDE 2000 via the JDBC drivers. > > If I use dataset.all, I see practically no difference with querying, copying > and inserting data from one database schema when comparing the two > platforms. Both take roughly 6 minutes +/- 20 secs. However, if I use > dataset.each, I see jruby taking 9 minutes and 8 seconds to do a clone while > Ruby MRI stays at 6 minutes 15 seconds, both +/- 20 secs on subsequent > benchmarks. That's about a 1:1.44 difference with Ruby MRI well > outperforming JRuby! The 20 seconds margin of error is simply me testing > during the day on production/live data where 30 or more users are actively > using the server (not ideal, I know, but good enough to see basic patterns). > > Hardware: Macbook Pro 2.33 GHz Intel Core 2 Duo 4GB RAM > All installed from macports or latest gems > > Ruby MRI: > ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9] > sequel 3.10.0 > ODBC Driver: Actual Technologies - Actual ODBC Driver for SQL Server version > 2.9e > > JRuby: > java version "1.5.0_22" > Java(TM) 2 Runtime Environment, Standard Edition (build > 1.5.0_22-b03-333-9M3125) > Java HotSpot(TM) Client VM (build 1.5.0_22-147, mixed mode, sharing) > jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2010-04-22 6586) (Java HotSpot(TM) > Client VM 1.5.0_22) [i386-java] > sequel 3.10.0 > JDBC Driver: Microsoft sqljdbc_3.0.1301.101 > > The code to clone a table: http://gist.github.com/377053 > > The only thing outside the GIST above is using two DB connections (two > different servers) and making the calls to the clone_table method. > > Am I doing something horribly wrong in JRuby, or is this par for the course? > > Michael > --http://codeconnoisseur.org > > -- > You received this message because you are subscribed to the Google Groups > "sequel-talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group > athttp://groups.google.com/group/sequel-talk?hl=en. -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
