--20cf3005dd2410f87204942ab7bd
Content-Type: text/plain; charset=ISO-8859-1

On Wed, Nov 3, 2010 at 12:54 PM, Ruby Me <i_baseet / hotmail.com> wrote:

> Hi
>
> Why people say that Ruby is a slow language? And is there any plans to
> make it perfrom better in the near future? I was trying to start
> learning it and someone told me it is slow and I really look for
> something with high performance.
>
>
> Thanks.
>
> --
> Posted via http://www.ruby-forum.com/.
>
>
Ruby 1.8 was, I think, the slowest widely used language in the world. They
put a lot of work into it, and Ruby 1.9 is around 4 times faster, and is
basically equivalent in speed to other dynamic languages (ie Python, Perl,
PHP). Depending on your use case, other implementations like JRuby, MacRuby,
and Rubinius, may also be even faster.

What are you working on? If you're doing systems level programming or heavy
math computing, then Ruby isn't a good choice. For pretty much everything
else, it works just fine. For some cases like web, it is a great choice. If
you find that it doesn't perform, you can profile your code to see where the
bottleneck is occurring, then optimize that spot (even dropping into a lower
language if necessary).

There are other tradeoffs to consider, though. If you select another
language, what you gain in speed, you may lose in environment. Ruby is is an
absolute delight to program in, and supports extremely powerful abstractions
that let you concisely express a concept, and that expression is all that is
needed to implement it. Check out things like Sinatra (
http://www.sinatrarb.com/) and Shoes (http://shoesrb.com/) to see what I
mean.

Also, depending on what you are trying to do, Ruby's speed probably doesn't
matter, because you'll be using gems that are fast since they wrap low level
libraries. I still get to use low level C libraries like libxml, but I don't
have to deal with C, I get to use them through an elegant Ruby wrapper like
Nokogiri. I get the speed advantage and the environment / interface
advantage.

That said, I still think there is hope for static languages, I just don't
know of any right now that would be worth putting up with. And Ruby can also
get better (especially as more people show interest in it), if Smalltalk and
Lisp can be so fast, then I think Ruby can too. If the world hadn't
abandoned Smalltalk, that might be a language worth checking out.

Of course, speed in the future is probably going to be based more on how
well your language can deal with concurrency, so in that regard, you might
choose a language explicitly intended to address this, like Clojure (If you
watch the screencast http://clojure.blip.tv/ at 38:30, Rich Hickey tells
this story where he does the traveling salesman on a java machine, and it
uses 600 cores!). If you think that is the case, then it isn't much of a
step to assume low level languages with poor support for concurrency will
fall behind, speedwise, in the future. Concurrency is _hard_ in C, but it's
trivial in Clojure.

Of course, good luck finding a job doing Clojure. If you care about the job
market, pick up a Java book and kiss your soul goodbye :P (I actually don't
hate Java, it just has a lot of things that could be much nicer. If it
wasn't for the JVM, though, Java wouldn't have anything to offer, and
fortunately, the JVM is not restricted to Java)

(hey, Steve, I think I ended up rambling too!)

--20cf3005dd2410f87204942ab7bd--