------ art_15342_12720538.1213028805487 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline *Ruby vs JRuby Performance <http://www.ruby-forum.com/topic/155783#686221>* Posted by Victor Reyes (Guest) on 09.06.2008 15:41 [image: (Received via mailing list)] I knew that there was a penalty to be paid when running JRuby, but I did not know how high. I developed a Sudoku solver, which actually solves simple to medium difficult puzzles. I am still struggling to make it solve "hard" problems. I just installed JRuby yesterday and wanted to compare it against Ruby. I executed the same program: The results are in: ruby -v ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] *Ruby: ruby sudoku01final.rb Elapsed Time: 0.437 Secs* jruby -v ruby 1.8.6 (2008-05-28 rev 6586) [x86-jruby1.1.2] *JRuby: jruby sudoku01final.rb Elapsed Time: 1.058 Secs* BTW, there is no GUI in my program. I hope to learn the GUI part with JRuby. That's the main reason why I downloaded JRuby, NetBeans, Java JDK/JRE, Etc. I guess there is trade-off which one must be willing to accept. Am I in the ball-park? Regards, Victor Reply with quote<http://www.ruby-forum.com/topic/155783?reply_toh6221#postform> *Re: Ruby vs JRuby Performance<http://www.ruby-forum.com/topic/155783#686235> * Posted by Jochen Theodorou (Guest) on 09.06.2008 16:15 [image: (Received via mailing list)] Victor Reyes schrieb: [...] > jruby sudoku01final.rb > Elapsed Time: 1.058 Secs* jruby has certainly higher startup costs than native Ruby, but that does not mean its overall performance is bad. I suggest you modify the program so it runs for example 10 times and then run again. I am sure the JRuby program will be very much below 10s bye Jochen Reply with quote<http://www.ruby-forum.com/topic/155783?reply_toh6235#postform> *Re: Ruby vs JRuby Performance<http://www.ruby-forum.com/topic/155783#686241> * Posted by M. Edward (Ed) Borasky (Guest) on 09.06.2008 16:28 [image: (Received via mailing list)] Victor Reyes wrote: > ruby -v > Elapsed Time: 1.058 Secs* > Send the source to Charlie Nutter ... he is always looking for jRuby performance test cases. Reply with quote<http://www.ruby-forum.com/topic/155783?reply_toh6241#postform> *Re: Ruby vs JRuby Performance<http://www.ruby-forum.com/topic/155783#686245> * Posted by ThoML (Guest) on 09.06.2008 16:31 > jruby -v > ruby 1.8.6 (2008-05-28 rev 6586) [x86-jruby1.1.2] > *JRuby: > jruby sudoku01final.rb > Elapsed Time: 1.058 Secs* Try to run it with jruby -J-server ... Reply with quote<http://www.ruby-forum.com/topic/155783?reply_toh6245#postform> *Re: Ruby vs JRuby Performance<http://www.ruby-forum.com/topic/155783#686249> * Posted by Lloyd Linklater (lloyd <http://www.ruby-forum.com/user/show/6864>) on 09.06.2008 16:44 Victor Reyes wrote: > I knew that there was a penalty to be paid when running JRuby, but I did > not > know how high. > I developed a Sudoku solver, which actually solves simple to medium > difficult puzzles. I am still struggling to make it solve "hard" > problems. > I just installed JRuby yesterday and wanted to compare it against Ruby. > > I executed the same program: > > The results are in: > *Ruby: > ruby sudoku01final.rb > Elapsed Time: 0.437 Secs* > > jruby -v > ruby 1.8.6 (2008-05-28 rev 6586) [x86-jruby1.1.2] > *JRuby: > jruby sudoku01final.rb > Elapsed Time: 1.058 Secs* > > Am I in the ball-park? According to the metrics posted here, JRuby runs about twice as fast, takes longer to load and uses a lot more memory. Here is a little something on the metrics: http://www.ruby-forum.com/topic/129990#new http://www.ruby-forum.com/topic/129996#new Team, First, thank you for all your comments. As suggested by JoChen, I executed the program under JRuby 14 times. To be fair to Ruby, I also executed it 14 times under Ruby. You can see the results below. As suggested by Ed Borasky, I will send the code to Charlie Nutter, if I can get his email. Otherwise I can post it here. It is not great code at all, but it is doing the work for now. I executed the program using *jruby -J-server* as suggested by ThoML and results are catastrophic! See the number belows! I only ran it 6 times. I also can't believe that jruby has been clocked at twice the speed of ruby since after all, jruby has more overhead than ruby. Then again, I am not expert on the subject (or any subject). *JRuby executions: *Elapsed Time: 0.888 Elapsed Time: 0.881 Elapsed Time: 0.977 Elapsed Time: 0.888 Elapsed Time: 0.872 Elapsed Time: 0.884 Elapsed Time: 0.869 Elapsed Time: 0.892 Elapsed Time: 0.876 Elapsed Time: 0.872 Elapsed Time: 0.882 Elapsed Time: 0.882 Elapsed Time: 0.867 Elapsed Time: 0.881 Elapsed Time: 0.906 Elapsed Time: 0.881 *Ruby executions:* Elapsed Time: 0.422 Elapsed Time: 0.391 Elapsed Time: 0.407 Elapsed Time: 0.406 Elapsed Time: 0.407 Elapsed Time: 0.422 Elapsed Time: 0.406 Elapsed Time: 0.438 Elapsed Time: 0.406 Elapsed Time: 0.406 Elapsed Time: 0.406 Elapsed Time: 0.39 Elapsed Time: 0.406 Elapsed Time: 0.406 Elapsed Time: 0.422 Elapsed Time: 0.39 *jruby -J-server sudoku01final.rb* Elapsed Time: 2.474 Elapsed Time: 2.467 Elapsed Time: 2.347 Elapsed Time: 2.404 Elapsed Time: 2.326 Elapsed Time: 2.414 Thank you Victor ------ art_15342_12720538.1213028805487--