Slashdot Log In
Ruby Implementation Shootout
Posted by
ScuttleMonkey
on Mon Feb 19, 2007 01:04 PM
from the always-with-the-shooting dept.
from the always-with-the-shooting dept.
An anonymous reader writes "Ruby has an ever growing number of alternative implementations, and many of these attempt to improve the suboptimal performance of the current mainstream interpreter. Antonio Cangiano has an interesting article in which he benchmarks a few of the most popular Ruby implementations, including Yarv (the heart of Ruby 2.0), JRuby, Ruby.NET, Rubinius and Cardinal (Ruby on Parrot). Numerical evidence is provided rather than shear opinions. The tests show that Yarv is the fastest implementation and that it offers a promising future when it comes to the speed of the next Ruby version."
This discussion has been archived.
No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Full
Abbreviated
Hidden
Loading... please wait.
Read the disclaimer... (Score:3, Insightful)
Re: (Score:2)
Also note that "average and Median values take in consideration only working tests (they exclude âToo longâ(TM) programs as well)", so the averages for Cardinal and Rubinious with many errors are of dubious utility.
Cardinal interesting (Score:4, Interesting)
I can't tell if those fast tests are so trivial that they offer little chance of further speedup, or whether YARV, which has had speed as a goal, is not going to be so much faster than a Parrot-based implementation once it (Cardinal) gets into working on optimization.
Anyone interested in providing some information on where the YARV performance comes from and whether Cardinal is likely to approach it more closely and farther across the board in the tests?
Re: (Score:2, Insightful)
Re: (Score:2)
You have to figure out the equivalent tasks(Mandelbrot seems to be be one) and then flip between the two benchmark pages.
Re: (Score:2)
Re: (Score:2, Informative)
Note that Parrot has had little optimization too.
A shear opinion... (Score:2, Funny)
Try "sheer".
Java not slow enough for you? Try Ruby! (Score:4, Insightful)
Re: (Score:3, Insightful)
Re: (Score:3, Insightful)
Except speed of code development.
So for my one-off scripts that run for 45s in ruby instead of 0.1s in perl, well
what's mattered to me is that it took 5 mins to write, rather than the 90mins +
a brain tumor that perl does*
* I last used perl at about 4.036, tried to get into "objects" with perl 5, and
jumped to ruby for the sake of my sanity.
Re: (Score:3, Insightful)
400 times slower? Still too efficient. Consider a Ruby implementation on the JVM and multiply inefficiencies! Should be thousands of times slower for those same benchmarks.
About JRuby; Sun recently hired [slashdot.org] two (both?) of the JRuby developers and progress has accelerated [codehaus.org]. The promise is a highly capable Ruby implementation running on a JVM. This, coupled with very recent changes to the JVM [artima.com] to facilitate scripting langua
Re: (Score:2)
There is no justification for this statement. One of the aims of JRuby is to compile to JVM byte code, which can then be translated to highly optimised machine code.
Apparently Sun isn't content to let Microsoft's CLR become the de facto standard bytecode runtime platform.
Do you realise how many instances of the JVM there are right now? Not just on servers, but on mobile devi
Re: (Score:2)
Any YARV experts (Score:3, Insightful)
Re:Any YARV experts (Score:4, Informative)
Slightly less short answer: if I'm not mistaken, YARV includes a JIT compiler, similar to what Psyco [sourceforge.net] does in the Python world. Psyco has been known to accelerate code execution up to 100x times, so I'd expect YARV to be even faster than this benchmark shows when it's stabilized.
Parent
Re:Any YARV experts (Score:5, Insightful)
This rule isn't exactly hard and fast, as verying implementations of VMs and interpreters can have different performance characteristics. For example, while perl is still probably considered an interpreted language, it's quite fast due to the interpreter using many compiler tricks such as parse tree optimizations. The ruby interpreter however has been notoriously slow, which is why ruby people are so excited about it.
Parent
unicode? (Score:3, Interesting)
Ruby and Unicode (Score:3, Interesting)
AAAAARGH!! (Score:2)
> vector of 8 bit bytes
No. No, no, no. NO. Please, no. Seriously. This is bad. A LOT of damage happens because people can't be bothered to spend the 10 minutes it takes to learn the basics of Unicode. It's easy. I don't always think very highly of what Joel Spolsky writes, but his introduction to Unicode [joelonsoftware.com] is an ABSOLUTE must-read.
Seriously. Strings are NOT interchangeable with byte arrays. EVER. Without an enc
Want unicode? Try tcl (Score:2)
Suggest you to start with this page [wiki.tcl.tk] to get a glimpse of what Tcl is all about!
Re:Want i18n? Try .NET (Score:2)
Of course you have to manually translate text strings into resource files for each language, but once you do that, programmatically switching b
Feature comparison? (Score:2)
I don't think anyone decides to use Ruby based on performance, really. I'd be a lot more interested to hear whether any new features (notably, proper Unicode strings and native threads) are included in any of these implementations -- I really can't use Ruby without at least the former. I would have thought the Java and
Good news on Yarv speed improvements (Score:2)
I would have prefered Ruby, BTW, because it is easy to train people in Ruby development while Common Lisp is a harder learning curve.
Once Yarv is very stable (maybe it is already?), then I will use Ruby for a larger percent of my new proj
Re: (Score:2)
My irb-yarv will not work (for me), but I have tried running ruby-yarv against the examples for my in-progress "Ruby AI" book and did not see any problems.
Yarv will be cool! Especially when it supports Rails.
Why not use C (Score:4, Funny)
Re: (Score:2)
Amen. With critical functions (XML parser, for instance) rewritten in assembly for speed.
Re: (Score:2, Insightful)
But really, Ruby's for more than just Web stuff. (As is Python and the rest.)
Re: (Score:2)
hmmm...Could it be the object-oriented programming language Ruby?
Ruby [wikipedia.org]
Re:so... ruby? (Score:5, Informative)
I was on the same boat until a couple of weeks ago ... anyway, Ruby is The Hottest Thing Since Sliced Bread (TM). It's a programming language that was created in Japan all the way back in 1995. However, it has only just recently garnered mainstream interest due to the emergence of a web application framework built on Ruby, which is called Ruby on Rails and is said to be an incredibly well-thought and efficient framework.
More on Ruby here [wikipedia.org].
And more on Ruby on Rails here [wikipedia.org].
I personally have an enormous interest in Ruby on Rails, as it seems to be a very neat way of writing web applications, but I'm also a bit daunted; it's a new language and a whole new framework with different ways of doing things, so it's been slow going learning it. I just wish I knew where to get some extensive sample code to peruse - that's how I learn best. All I've seen are some very basic applications which don't really teach you the real tricks and show how it all comes together.
Parent
Re:so... ruby? (Score:5, Informative)
Yes, Ruby is the current web development flavor of the month, however, don't get caught up in the hype. There are good number of MVC web development frameworks in other languages, including even Lisp and Smalltalk, but most notably Python. In my opinion it makes more sense to learn a Python framework for a number of reasons. Mainly because Python is used in considerably more non-web applications than Ruby, which makes your skills more portable (and you more employable). Ruby on Rails is also very monolythic, while two of the the three most popular Python frameworks, TurboGears [turbogears.org] and Pylons [pylonshq.com] are very modular (especially Pylons since it's built around the WSGI [wsgi.org] spec). Finally, Python compiles to bytecode whereas Ruby does not. Hence Python outperforms Ruby in almost every shootout [debian.org].
Further reading:
Of snakes and rubies; Or why I chose Python over Ruby [infogami.com]
TurboGears and Pylons (a technical comparison) [ianbicking.org]
From PHP to Python [rightbrainnetworks.com] (my blog)
Parent
Re: (Score:3, Informative)
Re:so... ruby? (Score:4, Insightful)
I find it amusing someone would say learn Python because it's used more. Python may be older, but it's still sitting in the programming language high chair right next to Ruby. People say the same thing about Python; "if you want a job learn Java, c#, c++"; and you know what they're right, if you want a job learn Java, period.
I like both Ruby and Python, and I think a programmer would do well to learn one or both. They aren't as popular yet, like Java or c#, but I think they will be. And if you understand the concepts in one, you'll understand the other. Like Gretzky said, "I skate where the puck is going to be, not where it is"; good advice.
I prefer Ruby, but that is just a preference.
Parent
Re: (Score:2)
Same here. I love Ruby, and I love the fact that there aren't any primitive types at all, everything is an object. You can do weird stuff like: a="Hello".downcase.reverse.capitalize That's just cool.
Strings as objects (Score:4, Interesting)
Well, you can also do it in Java .....
String a = "Hello".toLowerCase().toUpperCase();
.... but I'm not sure it makes a huge difference in real software development. I do however like it as the safe test for an exact match without worrying about null ....
if ("FOO".equals(a)) {
Parent
Re: (Score:2)
That's neat, I didn't know java could do that. But your example demonstrates another thing about Ruby I really like, if a function returns a bool, convention is the function should have a questionmark at the end.
...
if a.empty? then
It's very readable, and you know it's testing against empty and not setting it to empty.
Also if a function modifies the object in-place, then convention has it end with a !. So a.capitalize
Re:so... ruby? (Score:4, Funny)
Numerical evidence is provided rather than shear opinions.
Do those opinions come from sheeple?
Parent
Example Code (Score:2)
If you want to learn Rails, well... that's a bit harder. I recommend the Rails Cookbook... lots of good practical code in there. I don't know of a big, open source, Rails website that you can examine though. Haven't looked.
Re:so... ruby? (Score:5, Informative)
Parent
Re: (Score:2)
I think the "it just works" philosophy of the Mac has a lot in common with the similar philosophy of Ruby and Rails. So if you are attracted to Rails you are likely to be attracted to Apple products and vice versa.
Since Ruby adoption is l
Re: (Score:2)
Gack! Somebody needs to hire a graphic designer quick. That site is NOT a promising endorsement for RoR...
Re: (Score:2)
The big problem I have, though, is that most sites I see created by designers seem to follow the same rather boring mold. Every site developed in the last year or two looks just like every other site developed in the last year or two.
I'd appreciate knowing what it is that creates such a negative reaction to what I've
Design (Score:2)
You have three choices: 1) hire a designer; 2) get a template; 3) find a designer.
You've already indicated you don't want to do nu
When your server is Linux... (Score:2)
And if your server is Windows, I'd say you're on your own. If, for some perverse reason, you want it to work well, the code is there, but why should we help you?
Re: (Score:2)
You could mess with it on the server, which was my point. What makes your local Windows machine more convenient?
I could make this into a big deal about you refusing to roll out Windows at home, but I imagine this is closer to a minor inconvenience than a major stumbli
Re: (Score:2)
Re: (Score:3, Insightful)
And when will that happen, exactly? I've been hearing about R/RoR for years now, and it's still distinctly in the low-performance category. Yet every time I go visit the site for updates all I see is talk about how they're adding feature X and Y in the next point release.
These guys need to stop dinking with the language, freeze it, and work on fixing bugs and increasing performance so people out here in the real world can actually u
Re: (Score:2, Interesting)
Re: (Score:2, Insightful)
Ruby's almost 14 years old! By 2001, Perl had fantastic Windows support.
Now people may deploy Ruby or Perl or Python or PHP applications to Unix and Unix-like servers, but I know plenty of people who develop on Windows. Some of them even have a choice.
Re: (Score:2, Informative)
First off, the parent of my post said that the Windows port wasn't as fast as Linux and should be supported and worked on more. Ruby supports Windows just fine thank you.
Second, Ruby has had an interesting history. It was basically unknown in the west until Dave Thomas and Andy Hunt wrote the first book in English in 2000. At that time, the language started to take off, and only in the last few years has development really ramped up. So t