Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Ruby (http://www.programmingforums.org/forum63.html)
-   -   Ruby speed improvements with YARV (http://www.programmingforums.org/showthread.php?t=12682)

Jessehk Feb 26th, 2007 8:57 PM

Ruby speed improvements with YARV
 
In case you didn't know, a new virtual machine for Ruby called YARV (Yet Another Ruby VM) has been integrated into testing for Ruby 1.9.

In my own (very informal) testing, I've gotten speed ups of 2x to about 8x.
You can download it from the ruby-lang.org website.

Also, take a glance at this page for some benchmarks. http://www.antoniocangiano.com/artic...us-vs-cardinal

:)


EDIT: I thought I'd add a little example.

:

  1. def fib(n)
  2.   if n < 3
  3.     1
  4.   else
  5.     fib(n - 1) + fib(n - 2)
  6.   end
  7. end
  8.  
  9. fib(34)


:

  1. def fib(n):
  2.     if n < 3:
  3.         return 1
  4.     else:
  5.         return fib(n - 1) + fib(n - 2)
  6.  
  7. fib(34)


Ruby 1.8.5
:

$ time ruby fib.rb

real    0m15.306s
user    0m13.273s
sys    0m1.984s


Python 2.4.4
:

$ time python fib.py

real    0m6.857s
user    0m6.736s
sys    0m0.036s


Ruby 1.9 (2007 - 02 - 25)
:

$ time /usr/local/src/ruby/ruby fib.rb

real    0m2.048s
user    0m2.012s
sys    0m0.016s


DaWei Feb 26th, 2007 9:06 PM

I'm going to muse that if one needs to be concerned about performance, then one needs a language that reflects one's ability to code, and not a language that reflects the abilities of some version of its own implementation. The latter approach leaves one chasing after chimera, rather than ability.

Jessehk Feb 26th, 2007 9:14 PM

I'd agree that speed is not as important as the ability to be efficient when writing code.

I just made a point of this because many Ruby people have been complaining about the slow speed of the language. Now, there is some progress being made in that area. It's exciting. :)


All times are GMT -5. The time now is 1:49 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC