Ruby Implementation Shootout
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."
Can they update the article to give a brief blurb on what ruby is? Or is it something that has become so commonplace in the past 2 weeks that i'm a doof for not knowing?
Cause i read this and immediately thought of the chick who premiered with ati's r9x00 series video cards.
Is it sad that I am more likely to recognize you and your posts by your sig than your name or UID?
TC - My Photos..
Though not familiar with the project, I'm impressed that the project with by far the most errors (Cardinal), indicating I assume that the least work has been done on it, is still so close to YARV - only 2-4 times slower in a couple tests.
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?
they need to post the specs of the computer they where using tho, i could post numbers, but i would be running it on a p1 150mhz!
WulframII - Free Online Mutiplayer 3D Tank Shooting Game
v e r y _ s l o w ?
Try "sheer".
Performance isn't everything, but then again, when you are 400 times slower than Java... performance starts to matter.
Can anyone comment on why the YARV implementation is so much faster than the standard implementation? I know for example the SUN VM was originally only intended as a reference VM and faster implementations were developed but not on the scale of the differences highlighted here.
Do not try to read the dupe, thats impossible. Instead, only try to realize the truth
What truth?
There is no dupe
Anyone else immediately think of this old Kenny Rogers recording when they read this thread's title?
What's up these days with ruby and unicode? Of these implementations, do some do it one way and some another?
Find free books.
Yeah, I was watching my Rails app the other day and when the load spiked around 2pm, the whole ActionPack just sheared right off. I tried to re-attach it, but the bolts were all gone. Cheap Japanese plastic. I duct-taped it back in, but I gotta tell you, if it's one thing Ruby needs, it's more shear strength.
Why do you believe Java is slow? It's comparable to most compiled languages, and I'm not aware of any non-compiled languages that are faster than it.
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
I'd also be interested in standardization -- currently IIRC Ruby is specified as 'whatever Matz's implementation is observed to do, that's Ruby'.
Whence? Hence. Whither? Thither.
No, but it IS one of the slowest of the "dynamic" languages. Tcl, Perl and Python are all faster, have better threading and i18n support.
Why do you believe Java is slow? It's comparable to most compiled languages, and I'm not aware of any non-compiled languages that are faster than it.
Except Java is a compiled language. Ruby is an interpreted language.
The fact that Java manages to keep up with interpreted languages isn't really anything to brag about.
Java definitely isn't faster than other compiled languages, though. Compare any Java-based program with a native C++ implementation and the difference is like night and day: the C++ implementation will smoke it.
The reason people think Java is slow is because they've experienced it, and discovered that it is, in fact, slow.
Parrot's not a contender - it cannot even run 90% of the tests. And the ones it CAN run are 20 times slower. What problem is Parrot supposed to solve, again?
What's up is that there's massive disagreement on whether Ruby's standard strings and characters should become Unicode. There are quite a few people used to the old world where a string was interchangeable with a vector of 8 bit bytes, and they don't want to let go. To add to the problems, Unicode is controversial in Japan. So, expect Unicode to continue to be painful and inconsistent in Ruby even after the next major release.
GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
He didn't say that Java was slow. He said that Ruby was slower than Java. Since Java isn't 400 times faster than most other contemporary languages, that makes Ruby slower than most other languages out there. It doesn't affect Java's position vis-a-vis performance comparisons.
Just junk food for thought...
I would use Ruby more if the runtime performance were better. For speed and dynamic language niceness I use Franz Common Lisp for most of the work for my current customer (AI medical applicaion) and I still find myself using Java a lot for serverside deployment goodness :-)
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 projects.
This study backs up what everyone who has tried Ruby on Windows already knows... it stinks! I'm actually not surprised to see that some of their tests errored out completely on Windows, even with the Ruby 1.8.5 binary.
Granted, Ruby is mostly used with Rails right now, but you'd think that if the language proponents want the language to take off, Windows support would be taken more seriously. In the couple years since I first tried Ruby, it doesn't seem like it has improved much at all.
Performance isn't everything, but then again, when you are 400 times slower than Java..
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 two (both?) of the JRuby developers and progress has accelerated. The promise is a highly capable Ruby implementation running on a JVM. This, coupled with very recent changes to the JVM to facilitate scripting languages could lead to an interesting future. Sun is also leveraging the JVM for other language projects such as Fortress.
Apparently Sun isn't content to let Microsoft's CLR become the de facto standard bytecode runtime platform. I don't know whether it's possible to make Ruby performance on the JVM competitive with native implementations, but I am hoping.
Lurking at the bottom of the gravity well, getting old
C and cgi.
With all the different flavors, is this where Java is heading now that it's F/OSS licensed? It would be an interesting review a year from now to see how Java turns out--the same as Ruby's state or different (since there's a standard already in place and the JCP).
from TFA:
Numerical evidence is provided rather than shear opinions.
Would that be what the author thinks about scissors? For the semi-literate that should be "sheer opinion," not "shear opinions."
There's but one language you'll find with rigorous support of unicode to make it a non-thought, and that's tcl. Add to unicode the excellent wiki, a grammar completely defined in eleven rules, and a versatile cross-platform GUI toolkit, and you've got a language that can't be beat for a great many situations.
Suggest you to start with this page to get a glimpse of what Tcl is all about!
If your program doesn't have to return the right answer, it's very easy to make it go really fast.
Are you adequate?
Consider a Ruby implementation on the JVM and multiply inefficiencies! Should be thousands of times slower for those same benchmarks.
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 devices and phones? There is not the slighest chance of the CLR becoming the de-facto anything.
...why do you care about Windows support?
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?
Don't thank God, thank a doctor!
Yep, I agree. Ruby's slow. Probably slower than the rest at just about everything.
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.
Red to red, black to black. Switch it on, but stand well back.
Hmm... maybe you just overlooked it, but if you want to learn Ruby, then read the source code for Rails. There's a ton of it, and it's relatively well written and easy to follow, with good commenting. It makes heavy use of Ruby-isms like polymorphic code. It's huge, and it works.
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.
"I will trust Google to 'do no evil' until the founders no longer run it." Hello Alphabet.
> There are quite a few people used to the old world where a string was interchangeable with a
> 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 is an ABSOLUTE must-read.
Seriously. Strings are NOT interchangeable with byte arrays. EVER. Without an encoding information, a byte array can represent a wild number of different strings. Without an encoding information, you can't even tell where the string that the byte array represents ends! This is one of my pet peeves, really -- pretending that byte arrays and strings are equivalent is on the same level of professionalism as pretending that the data won't ever be larger than your buffer. Ignoring issues that bother you don't make them go away.
-- B.
This sig does in fact not have the property it claims not to have.
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)) {
Why do half the links on the bottom go to pages with no format? Why do About us and Safety Tips use different layouts, widths, line widths, etc. Why the 1980's-style colored text on a patterened background on the home page? Why is the page style/font/color scheme different from the logo scheme, which is different from the sign-up block, which is different from the sign-up button.
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 number 1. Fine. There are thousands of page templates available for $50 or so. Go through those and find somethng that works for you. Standing out is all well and good, as long as you're not standing out by looking amateur, home-built, and unprofessional. That's not so good.
Third, find an art school nearby and see if you can work out a trade with someone. A design for some of your time, or a design for their portfolio, or just a design that's cheap ($100?).
You're trying to get people to sign-up and give you their name, email, and personal information (. You can NOT afford to look untrustworthy. Good luck.
Any sect, cult, or religion will legislate its creed into law if it acquires the political power to do so.
Say what you will about Micrsoft, but they do it better than just about anyone else as far as internationalization goes on the .NET platform. They go beyond pervasive support for Unicode: the framework has built in support for all standard ISO cultures, and can automatically translate and format dates, numbers, currencies, etc. on the fly with almost zero extra code.
.NET standard library automatically checks the Thread.CurrentCulture object and displays the appropriate unicode text, date, and number formats, so you don't have to do those language checks everywhere yourself.
Of course you have to manually translate text strings into resource files for each language, but once you do that, programmatically switching between languages extraordinarily simple. You can easily read the language preference from a vistor's browser and display the code in the correct language, in about 5 lines. All of the
IDE Support.
I love Ruby. I did a RoR project, learning Ruby and RoR at the same time, got the whole thing up and working in 3 odd weeks. I was impressed with the elegance of the Ruby API and even more so with the supreme elegance of the Ruby on Rails API - it's awesome. It's what's Java with its mess of backwards compatible and not-well-thought-out and clunky APIs can only dream of. [Note: I am a professional Java dev]. Things that should only take a line of code, do. Unlike Java where they take 2 classes, a thread and one listener.
The main problem is that there is no proper IDE for it. By which I mean, something on par with the java development tools in Eclipse or IntelliJ for Java. Sure there's some stuff out there that does mild syntax highlighting, things like that - beefed up text editors.
But if I have a project consisting of 50 CVS modules and tens of thousands of classes, I don't want to be either hand-editing all of them or doing a text-grep search or alternately perhaps better not rename a method at all. I am used to refactoring and call tree hierarchy views, I use them every day and multiple times a day. Refactoring has made a significant contribution to improving code quality. If I don't like something, I change it - the IDE takes care of finding all affected files and making all the changes.
There are also numerous other benefits which mean I don't have to define variables in Java (IDE does it), don't have to look up API docs (popups with that appear, with all possible methods etc), and most importantly whenever I make a tiny change somewhere in some file the live compiler tells me if that breaks anything else. Huge time savings. Without this it would easily take 5 times as long and some things would be just impractical to do.
Ruby proponents easily get defensive and proclaim that Ruby's so good that all you need is a text editor. Sadly, that's absolutely not true and these people have never used refactoring. Or written large pieces of software. If you have done both and still think it's not needed please explain to me how you deal with the complexity: How do I rename a method, then?
But I understood the Ruby one right away. "reverse" is just easier to understand then "[::-1]". And don't waste your time explaining it, or to tell me how elegant or nifty "[::-1]" is - I understood "reverse" right away and that is what counts.
Martin
Often overlooked: C is a system programming language and not an application programming language. C was designed to write the Unix operating system and quite honestly it is not good for anything else.
Yes you can use C for all sorts of other programming needs (if you have a masochistic tendence) - all programming needs in fact as C is turing complete - but it isn't any good at it.
Martin
Note: I have learned C in 1990, updated my C knowledge regularly, own a copy of the C99 ISO standard and I have quite a lot of experience in C programming.
Say what you will about Microsoft, but Apple did this in Mac OS X about 5 years before .net existed, and even now Microsoft Office's support for Unicode is rubbish (even on Mac OS X).
Microsoft is about the only company in the world with the arrogance to override a built-in system language/font API that works with a proprietary one that doesn't, but then this is the same company that is trying to replace ISO standard dates with their own version that marks 1900 as a leap year when it wasn't:
http://www.charcoaldesign.co.uk/weblog/10
Apparently Sun isn't content to let Microsoft's CLR become the de facto standard bytecode runtime platform.
Here's your pot, smoke it. You need it.
Dude... In the real-world, such as the banking world, stuff like a bullet-proof VM running on bullet-proof OSes has made Sun's JVM a standard that shall still be there in decades. Those security concerns have ruled anything named 'Microsoft' out of the picture. The server-side in the real-world is all Java-backed, wheter you like it or not. And this is very good, for it means JRuby may have a chance in the real-world.
We have been using Ruby in a production environment for the last seven years at a company that trades a significant portion of Nasdaq and NYSE-listed securities. We have been using C++ for the performance-critical portions of the system and Ruby for the portions of the system that we want to get out the door more quickly. I won't lie: we've run into more than once case where the Ruby interpreter just wasn't fast enough. However, had we done the initial pass in C++, it could have taken days or weeks longer to develop.
This really is where the power of dynamic languages like Ruby and Python lies -- rapid development followed by benchmarking followed by optimizing the portions of the code that aren't fast enough. We tried doing the same with Java, but the language interoperability wasn't there, nor was the rapid development (at the time JRuby and similar projects were much less mature than it is today).
I should also mention that I was skeptical of this model at first, and in fact it didn't work at first. Ruby has a small learning curve, but there are aspects of our particular application that made integration of Ruby into the system more than a little challenging. Now that we have the framework in place, though, I really like the results and don't want to imagine the system working any other way (with respect to what I've discussed here).
Yes, even if i like perl very much to do small text filter/cgi-bin/data aggredgation programs now and then, the "OOP" Features in it give everybody taking OOP seriously instant headaches....
It really depends on the use case, you basically run into the classical statically compiled vs. dynamically runtime optimized problem. The fact alone, that java is able to render its own ui at very good speeds nowadays, is proof enough, that java is not as slow as people constantly shout, sheesh, have you even ever seen any java program on a modern vm or are you still stuck with the Microsoft VM!
It's too bad you left then.
:)
Perl 5 is when things finally got interesting. I hated Perl 4, but I don't think I could live without Perl as it is today!
Granted, Perl pales in comparison to Ruby when it comes to "interesting" (and I mean that in a good way! (for ruby))
Use the right tool for the job. And that depends on the job, the toolbox, and the programmer. For example, for interfacing with our hideous OSS gateway most programmers would use Java. I would use a length of steel rebar and a lot of foul language.
I'm done with sigs. Sigs are lame.
OS X 10.0 was released from beta in 2001. The first release of Visual Studio.net was in 2002. You're clearly misinformed if you think there was a 5 year time difference.
.NET to WebObjects or Cocoa. I am not familiar enough with either of those to make a comparison.
More importantly, pervasive OS support for Unicode is one thing, but making i18n support easy for developers is someting else entirely. A more apt comparison would be
WTF is a "standard culture"?