Ruby Vs. Java

N

Nick Nick

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.
 
H

Hank Gong

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

Stefan Rusterholz

Nick said:
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
 
N

Nick el

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.
 
P

Phlip

Nick said:
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 Thomas, an author of the Pickaxe Book for Ruby, describes the situation
as "Ruby stays out of your way".
 
P

Phrogz

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?
 
P

Phlip

Nick said:
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.
 
A

Ari Brown

Assembly is faster than
C is faster than
Java is faster than
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
 
I

I. P.

|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.
 
L

Lionel Bouton

I. P. said:
|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.
 
P

Phlip

Lionel said:
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...
 
M

Michael Glaesemann

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

You use a hex editor? Real hackers use only ones and zeros=97and that's =20=

only if they have ones.

Michael Glaesemann
grzm seespotcode net
 
X

Xavier Noria

You use a hex editor? Real hackers use only ones and zeros=97and =20
that's only if they have ones.

I saw once a cartoon about real programmers where a guy was sitting =20
in front of a terminal with a keyboard that had only two keys, =20
labelled "0" and "1", hahaha.

-- fxn
 
N

Nick el

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.
 
J

John Joyce

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.
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.
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!
 
U

Uma Geller

funny enough... but isn't this exactly the way
telegraphs used to work ?

I saw once a cartoon about real programmers where a guy was sitting
in front of a terminal with a keyboard that had only two keys,
labelled "0" and "1", hahaha.

-- fxn


--=20
best,
UG
 
N

Nick Sch

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.
 
J

John Joyce

That was the previous system; only one key.
One key, relative short or long key press and pauses between words.
then as now, the error was usually between the desk and the chair.
 
M

Marc Heiler

"I'm going to try both Java and Ruby out before I choose. "

But Java _is_ faster.
It's also uglier and less fun than Ruby.

If you need a proper speed, just stick to the static
languages. If you want the fun, go with Ruby. :>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,120
Latest member
ShelaWalli
Top