Re: How to speed up ruby and make it as fast as possible

In answer to the multiple messages recommending that I learn C or
Assembler as the solution for performance, it appears that you did not
read my lips: I want to use Ruby, not a typically tedious, often
verbose, yet also cryptic strongly-typed language! I have read
tutorials on such languages before and found their nature to be counter
to my desire for rapid application development. I understand that no
single language is superior in all criteria, and that trade-offs exist
between ease of development and speed of execution. I just want a
better combination of these and believe it is possible for the Ruby
language to progress in this way. I think the more that others also
express this interest, rather than deflecting attention away from Ruby,
the more likely that our community will find the means to deliver these
advancements.

The trend in universities, by the way, is away from teaching native C.
Instead, Java and C# for the .NET platform are taking over. That argues
against learning C specifically to compensate for Ruby’s weakness. If I
were to invest in the hundreds of hours to become facile in a strongly
typed language, C# would be the one most likely to benefit my
productivity and career. (As much as I like Ruby, it is a means to an
end for me, not an end in itself.)

Jamal

Jamal M. wrote:

express this interest, rather than deflecting attention away from Ruby,

Jamal

One, Rite seems to be what you’re looking for, and it will come in time.
C is the best solution until then.

Btw, C have mostly never been teached at universities, since the point
of learning programming languages at Uni’s is to take a look at concepts
of programming, not learn something that can be used professionally. The
reasons that C isn’t used to teach programming concepts is the same
reason that makes it efficient enough to be really fast.

If you’re just interested in speed, have you thought about looking at
other very high level languages? OCaml is wicked fast and statically
typed, yet at a mostly higher abstraction level than even Ruby.


Ola B. (http://ola-bini.blogspot.com)
JvYAML, RbYAML, JRuby and Jatha contributor
System Developer, Karolinska Institutet (http://www.ki.se)
OLogix Consulting (http://www.ologix.com)

“Yields falsehood when quined” yields falsehood when quined.

A university should not be the source of the languages you know. I’m
sure you know this since you are learning ruby. BUT a large amount of
programming is not just doing something in a way that you like, but
dealing with the tools that are given to you. the fact is ruby or any
interperated language will never be as fast as C and java’s vm will
never be as fast as C either. Sometimes C is not fast enough that is
why MOST games use large portions of in line assembly for some specific
functions. I’m not saying dont make java or ruby or perl as fast as
possible but there is an upper boundary in speed. The reason Ruby and
Perl exists is because processing speed is becoming a easy to find
commodity for most applications a far cry from the 8086 or 800 days.

Jamal M. wrote:

In answer to the multiple messages recommending that I learn C or
Assembler as the solution for performance, it appears that you did not
read my lips: I want to use Ruby, not a typically tedious, often
verbose, yet also cryptic strongly-typed language!

Fine, use Ruby. But if performance is critical then you will be
disappointed. You have been warned but you are clearly not prepared to
listen.

I have read
tutorials on such languages before and found their nature to be counter
to my desire for rapid application development.
What happened to your desire for performance. Is this now secondary to
laziness?
I understand that no
single language is superior in all criteria, and that trade-offs exist
between ease of development and speed of execution.
The you will just have to accept the trade off between ease of
development and performance. If you really really really want
performance then write it in C.
The trend in universities, by the way, is away from teaching native C.
Instead, Java and C# for the .NET platform are taking over. That argues
against learning C specifically to compensate for Ruby’s weakness. If I
were to invest in the hundreds of hours to become facile in a strongly
typed language, C# would be the one most likely to benefit my
productivity and career. (As much as I like Ruby, it is a means to an
end for me, not an end in itself.)

I find it hard to understand how someone can call themselves a
programmer and then claim that learning C is too difficult. It’s not as
easy to use as Ruby, but it could hardly be called difficult. Being a
programmer, for me, is being in a constant state of learning. Perhaps
for some it is just a 9 to 5.

For what it’s worth here is my solution to the performance problem. When
performance becomes an issue - I switch to chicken scheme
http://www.call-with-current-continuation.org/. I’m more productive
coding
in ruby but occasionally speed becomes an issue. C is far too much
hassle
but ruby translates nicely into scheme and chicken scheme compiles to C
and
in my experience this solves any performance problems I have.I realize
this
is not the solution you are looking for but I thought it might be
interesting none the less. Scheme, in my opinion, is on par with Ruby
with
respect to power and expressiveness but it is much less “human
friendly”. I
find translating from Ruby to scheme generally very easy but even though
I
have been writing Ruby for 1/10 the time I have been writing scheme I am
much faster at coding Ruby than scheme.

With regards to deflecting attention away from Ruby I would disagree
that
that is an issue. Ruby stands strong on its merits. Bringing other
languages
to the table does not dilute Ruby’s strengths. For the occasional
performance critical problem where Ruby by itself is a non-ideal
solution
dropping back to the “prototype in ruby, implement in X” is reasonable.
What
was interesting about this discussion for me were the X’s proposed. In
my
case the X (scheme) has many of the same features that make Ruby
powerful.

Matt

James B. wrote:

concepts of programming, not learn something that can be used
The reasons for, and value of, learning C have nothing to do with what
Ruby faster. Who actually writes that C code is another matter. Maybe
that’s another reason to learn C: to help with Rite.

I’m sorry to say that I don’t understand half of what you’re saying,
since most of your text is self contradictory with your latest postings.

Further, I never said C is strongly typed, I was referring to this
statement from you “If I were to invest in the hundreds of hours to
become facile in a strongly
typed language…”. C is my mother tongue and probably the language I’m
best at, but that doesn’t mean I like doing construction work with a
tooth pick (to paraphrase very good song). Sometimes a tooth pick is
necessary, mostly it’s not.

Regarding programming at universities, you tend to use the words school,
college and university referring to the same entity, which at least
where I come from (Sweden) is really not the same things at all.
Teaching programming in C doesn’t really have a place in the curriculum
at a respectably CS University.

Anywhat.


Ola B. (http://ola-bini.blogspot.com)
JvYAML, RbYAML, JRuby and Jatha contributor
System Developer, Karolinska Institutet (http://www.ki.se)
OLogix Consulting (http://www.ologix.com)

“Yields falsehood when quined” yields falsehood when quined.

Ola B. wrote:

One, Rite seems to be what you’re looking for, and it will come in time.
C is the best solution until then.

Btw, C have mostly never been teached at universities, since the point
of learning programming languages at Uni’s is to take a look at concepts
of programming, not learn something that can be used professionally. The
reasons that C isn’t used to teach programming concepts is the same
reason that makes it efficient enough to be really fast.

C was taught at my college as part of a general program related to
operating systems. It was the second programming language I learned,
and while I do no C coding now, being able to read C is very helpful if
you want to understand Ruby mechanics. This can help you write faster
Ruby code.

The reasons for, and value of, learning C have nothing to do with what
goes on at universities; I would think that the rise in emphasis on Java
and .Net would suggest that many schools are more interested in
vocational training than computer science education.

I understand why someone might not want to learn C and why they would
prefer to do all coding in Ruby or some other language that offers
higher abstractions. On the other hand, one should maybe know at least
enough about C so as not to mistakenly call it a strongly-typed
language.

I Rite, like Ruby, is written in C, so one way or another C will make
Ruby faster. Who actually writes that C code is another matter. Maybe
that’s another reason to learn C: to help with Rite.


James B.

“I was born not knowing and have had only a little
time to change that here and there.”

  • Richard P. Feynman

Matt Welland wrote:

For what it’s worth here is my solution to the performance problem. When
performance becomes an issue - I switch to chicken scheme
http://www.call-with-current-continuation.org/. I’m more productive
coding
in ruby but occasionally speed becomes an issue.
[snip]

Thanks for pointing that out, it looks really interesting!

-Justin

Ola B. wrote:

Further, I never said C is strongly typed,

I was replying to a comment quoted in a previous post, not you, and the
quoting may have gotten borked.

Teaching programming in C doesn’t really have a place in the curriculum
at a respectably CS University.

We live on different planets.

Anywhat.

Yes.


James B.

“Blanket statements are over-rated”

Teaching programming in C doesn’t really have a place in the curriculum
at a respectably CS University.

We live on different planets.

Random semi-relevant comment in regards to MIT:

“In the 2003-04 school year, Java was used as the programming language
for Computer Science. Prior to 2003-04, C++ was used.”

Just thought I would throw that in for one of the most respected
institutes in the country.

Michael S. wrote:

Random semi-relevant comment in regards to MIT:

“In the 2003-04 school year, Java was used as the programming language
for Computer Science. Prior to 2003-04, C++ was used.”

Just thought I would throw that in for one of the most respected
institutes in the country.

Not if they keep that up.

:slight_smile:

On 7/14/06, Michael S. [email protected] wrote:

Just thought I would throw that in for one of the most respected
institutes in the country.

What happened to Scheme at MIT? I thought Scheme was used as the
introductory langauge.

so now even MIT is a java school…

Phil

On Jul 14, 2006, at 3:38 PM, Phil T. wrote:

What happened to Scheme at MIT? I thought Scheme was used as the
introductory langauge.

so now even MIT is a java school…

6.001 Structure and Interpretation of Computer Programs

http://sicp.csail.mit.edu/Spring-2006/

I think you are oversimplifying the MIT example. Just a month or two
ago I completed an Open Courseware offering on MIT’s website that was
totally based on Scheme. And this offering wasn’t from 20 years ago. It
was current as of the past 2-3 years IIRC.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs