Ruby Vs. Java

Which programming language is faster - Ruby or Java?

This is one of the things that will decide whether I use Ruby or Java so
help is appreciated greatly.

Thanks.

Nick el wrote:

Which programming language is faster - Ruby or Java?

This is one of the things that will decide whether I use Ruby or Java so
help is appreciated greatly.

Thanks.

Development speed: Ruby, hands down
Execution speed: Java, hands down

That said, the main problem with execution speed are poor algorithms.
With ruby, you develop it, maybe in a quarter of the time you’d need in
java, then you see if it is fast enough. Most often you’ll see it
already is. If not, you profile. Most often you’ll then notice it is one
or two bottlenecks only. You’ll see if you can make it faster using pure
ruby, if that fails, you can always write a C extension (or use a java
lib if you use jruby). In the end you spent half the time you’d spend
with java and your app runs fast enough.

Similar thing probably with java vs. c.

Regards
Stefan

It depends what you mean by faster,

faster to learn,
faster to build a production quality application in,
faster to start up,
faster to execute

each will have a different answer, some quantifiable and some not.
Things like execution will depend on what you are doing, there are some
sites that benchmark languages
eg. http://shootout.alioth.debian.org/
that may help you.

Though depending on what you are doing pure execution speed may or may
not
be the most important thing.

cheers

simon

Java code is definitely faster than Ruby code.
However, to solve same problem, programming in Ruby should be faster
than doing that in Java.

I meant faster as in executing I guess. If you see I just posted a
question relating to a 2D MMORPG game / maker. I’d like the game to be
fast and not necessarily faster coding wise. Thanks for the feedback.

On 26/08/07, Nick el [email protected] wrote:

I meant faster as in executing I guess. If you see I just posted a
question relating to a 2D MMORPG game / maker. I’d like the game to be
fast and not necessarily faster coding wise. Thanks for the feedback.

have you considered Ada for this job? It’s even faster and clearer than
Java, and it has such features like builtin Tasks.

-Thomas


Thomas P.
[email protected]
[email protected]
030- 49 78 37 06
0176 - 75 03 03 04

On Aug 26, 6:16 am, Nick el [email protected] wrote:

I meant faster as in executing I guess. If you see I just posted a
question relating to a 2D MMORPG game / maker. I’d like the game to be
fast and not necessarily faster coding wise. Thanks for the feedback.

Assembly is faster than
C is faster than
Java is faster than
Ruby is faster than
JavaScript in a Web Browser

You could develop in any of these. You need to decide: how fast does
it really need to be?
You want it to run ‘fast’.
How do you know that both Ruby and Java are not both too slow?
How do you know that both Ruby and Java are not both way fast enough?

Nick N. wrote:

Which programming language is faster - Ruby or Java?

Those who tried both have learned programming Ruby is much faster. You
can
typically add a feature with the fewest edits. Java uses many negative
systems, including static type checking and a redundant “import”
command,
that make you generally sit around filling out forms just to get anythig
done.

Dave T., an author of the Pickaxe Book for Ruby, describes the
situation
as “Ruby stays out of your way”.

Nick el wrote:

I meant faster as in executing I guess.

Look up “premature optimization is the root of all evil”.

When you pick a language that’s repulsively hard to program, just
because a
newsgroup said it’s faster in general, that’s an example why premature
optimization is the root of all evil. You will program slower, hence you
will have less time in your schedule to profile and determine the real
slow
spots. Programmers should write clear code (in a clear language) and
never
try to guess what will be slow. It’s easier to make clear code fast than
make fast code clear.

If you see I just posted a
question relating to a 2D MMORPG game / maker. I’d like the game to be
fast and not necessarily faster coding wise. Thanks for the feedback.

Games have two layers. The lower layer, the graphics rendering engine,
should be written in a C language, and it should directly access
hardware.
The upper layer should be in a soft language, for scripting the game
events.

You probably want to write the upper layer and reuse one of the existing
lower layers, such as SDL (IIRC) or OpenGL. So use Ruby for the upper
layer,
because it makes scripting tasks very easy. Much of Ruby development
consists of building and using “Domain Specific Languages” that are easy
to
read and write. Your top layer could be as clear as
“orc.attack(hobbit)”.

Because only one line of upper layer code needs to run for every ten
thousand lines of lower layer code, the performance of the upper layer
is
less important. If you have any further constraints, such as a small
footprint, or a very big upper layer, you could split the difference and
use
Lua. It’s harder to program than Ruby but much easier than Java, and its
speed can compete with C.

On Aug 26, 2007, at 10:30 AM, Phrogz wrote:

Ruby is faster than
JavaScript in a Web Browser

Remember, hardware is cheap, software is hard, and time is money.

The bulk of your system might be serverside - Go to your local
computer recycling shop and get a decent computer, then trick it out.

If you find your game might not be fast enough then, start grinding
the database where the data is stored - thats what they’re meant for.

If you code in Ruby, you will find that troubleshooting and just
plain old coding will be tons easier.

Good luck,
---------------------------------------------------------------|
~Ari
“I don’t suffer from insanity. I enjoy every minute of it” --1337est
man alive

|Phrogz|

P> Assembly is faster than
A monk once asked ruby-talk: “Which programming language is faster -
Ruby or Java?” Ruby-talk said: “MOV”.

Sorry, can’t resist.

I. P. wrote:

|Phrogz|

P> Assembly is faster than
A monk once asked ruby-talk: “Which programming language is faster -
Ruby or Java?” Ruby-talk said: “MOV”.

Sorry, can’t resist.

Real (wo)men program in machine language with an hex editor only. Bonus
points for using a one-line editor which crashes randomly.

I’m wondering why some programmers with little experience (at least in
Ruby) want to program a MMORPG in Ruby… IIRC the last questions on the
subject didn’t even specify if they were speaking of the client or the
server side (or do they already have a fully decentralised MMORPG
architecture working in their head?).

Lionel.

Lionel B. wrote:

I’m wondering why some programmers with little experience (at least in
Ruby) want to program a MMORPG in Ruby… IIRC the last questions on the
subject didn’t even specify if they were speaking of the client or the
server side (or do they already have a fully decentralised MMORPG
architecture working in their head?).

Iiiii been workin’ on the Flash -> Juggernaut -> BackgrounDRb -> Ajax ->
Rails road…

All the live-long day…

On Aug 26, 2007, at 11:13 , Lionel B. wrote:

Real (wo)men program in machine language with an hex editor only.

You use a hex editor? Real hackers use only ones and zeros—and that’s
only if they have ones.

Michael G.
grzm seespotcode net

I would use Ruby and then use C to do lower level tasks: including
making use
of any Ruby bindings to things such as SDL to keep more of it in the
Ruby
world. If the game is small enough you could probably do it all in Ruby
or
Java without any thing to worry about. Unless of course you expect it to
run
on old hardware (like 15-30 years old hardware).

A simple point being, Ruby is easier on most peoples time then C while C
is
more efficient of the machines time then ours.

My experience with Java is roughly a decade out of date… But in my
opinion
Java has a good design on a number of things but is to verbose and
annoying
to be great language. I’ve always found the common ‘Hello world!’
programs
most language introductions start with as a good way to see just how
much
typing is expected for small tasks. I remember when I first started
Java, I
thought system.out.println() was nicely arranged but so much more typing
then
printf(). I learned a lot through studying Java but did my darn’st to
not
write any Java programs.

I’ve found Ruby to be a very good balance for many things. While it
might not
be the fastest on execution time but it makes a tremendous improvement
in the
amount of time spent testing and debugging code. Even if you just chalk
it off
to less lines of code needed for more complex tasks, Ruby is more
efficient
for a lot of things. Things that are hard to do in Ruby or proof to much
of a
bottleneck. Can be moved into a C Extension; if neccessary & you know
how,
optimised at a lower level then Ruby as well. C is beautiful, Ruby is
Effective, together they are probably awesome in some ways xD

I was once told the language you find yourself using most is the one
that best
suits you. That is what I usually suggest for people to use, the
language that
suits them best. Why code in one language if you are better able to
produce
quality code in another unless you had to?

TerryP.

Excellent point.

In my experience the speed of program execution has nothing to do with
the
underlying language/hardware and everything to do with your design.
My
theory is that program in Assembly language is fast, not just because it
is
machine language, but because it is hard to generate convoluted and
redundant structure. More importantly assembly language programmers are
different than Visual Basic programmers. Scarcity tends to generate
efficient design.

Java is faster than ruby, but if you write a java program that every
interaction results in 100s of SQL calls (all faithfully generated by
you OR
mapping) then you are not really measuring Java performance, rather your
design.

The real question is can Ruby developer develop better code than Java or
not. You can’t really answer that question until it is widely accepted.
You need to see what Avg Joe Programmer produces. One issue is that the
higher level programming languages attempt to separate the application
programmer from the engine/frame work. Domain specific languages
separate
the programmers into domain language developers and the users. As time
goes
on, the application developers tend to lose touch of reality and the
underlying trade offs. In my experience this always resulted in
application
programmers develop monsters. (and good source of income for people
that
clean up after them!)

Ruby does it Meta programming differently than java, may be it produces
better results at the end. Ruby look interesting but, at this point, I
feel it is hard to evaluate how Ruby would play out with Avg Joe
Developer.

daryoush

Wow thanks for all the support everyone!

QUOTE:

How do you know that both Ruby and Java are not both too slow?
How do you know that both Ruby and Java are not both way fast enough?

Well, have any of you played any kind MORPG? Ever heard of lag? I hate
lag and I want little of it as possible. But I guess that also depends
on the quality of the code.

QUOTE:

Programmers should write clear code (in a clear language) and never try
to guess what will be slow. It’s easier to make clear code fast than
make fast code clear.

You’ve got a point there. That just revised my thinking.

QUOTE:

I’m wondering why some programmers with little experience (at least in
Ruby) want to program a MMORPG in Ruby… IIRC the last questions on the
subject didn’t even specify if they were speaking of the client or the
server side (or do they already have a fully decentralised MMORPG
architecture working in their head?).

Well, I guess I over exaggerated by saying “MMORPG”. But don’t a lot of
people with their games (they have a small community and still call it a
MMORPG)? I guess I’m talking like that now. It’s not going to be to
big (I think) but it will hopefully draw interest. I don’t plan on
immediately making the game. I’m going to spend a very long time
learning the language.

Thanks for all the feedback everyone. Now I will decide.

On Aug 26, 2007, at 5:39 PM, Nick el wrote:

Wow thanks for all the support everyone!
This list tries hard to help!


Well, have any of you played any kind MORPG? Ever heard of lag? I
hate
lag and I want little of it as possible. But I guess that also
depends
on the quality of the code.

But ultimately it will always depend on the network. Any net traffic/
slowdowns of any kind between the user and the server will cause lag.
Unavoidable without a proprietary network.

Indeed good code that is readable is much more productive.

Well, I guess I over exaggerated by saying “MMORPG”. But don’t a
lot of
people with their games (they have a small community and still call
it a
MMORPG)? I guess I’m talking like that now. It’s not going to be to
big (I think) but it will hopefully draw interest. I don’t plan on
immediately making the game. I’m going to spend a very long time
learning the language.
That’s the right attitude! have a project that gives you a reason to
start learning a language (or even a framework) and you will get
farther with the language at least!

funny enough… but isn’t this exactly the way
telegraphs used to work ?

I’m going to try both Java and Ruby out before I choose. Although I did
take Ruby’s 20-minute intro and I liked it a lot.