Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 26th, 2007, 7:57 PM   #1
Jessehk
The Oblivious One
 
Jessehk's Avatar
 
Join Date: May 2005
Location: Ontario, Canada
Posts: 630
Rep Power: 4 Jessehk is on a distinguished road
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.

ruby Syntax (Toggle Plain Text)
  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)

python Syntax (Toggle Plain Text)
  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
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS!

Last edited by Jessehk; Feb 26th, 2007 at 8:09 PM.
Jessehk is offline   Reply With Quote
Old Feb 26th, 2007, 8:06 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Feb 26th, 2007, 8:14 PM   #3
Jessehk
The Oblivious One
 
Jessehk's Avatar
 
Join Date: May 2005
Location: Ontario, Canada
Posts: 630
Rep Power: 4 Jessehk is on a distinguished road
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.
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS!

Last edited by Jessehk; Feb 26th, 2007 at 8:28 PM. Reason: Missed DaWei's point completely. I was sick today, so I have an excuse. ;)
Jessehk is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ruby or Python? titaniumdecoy Other Scripting Languages 2 May 30th, 2006 12:51 AM
Ruby guides/References list Jessehk Ruby 2 Mar 21st, 2006 11:31 PM
Ruby Classes tutorial bulio Ruby 5 Oct 29th, 2005 11:32 PM
Assignment of numbers to variables without asking Haz C# 26 May 23rd, 2005 10:30 AM
C# Pilot Program Haz Existing Project Development 9 May 2nd, 2005 9:27 AM




DaniWeb IT Discussion Community
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