[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ruby Vs. Java

Nick Nick

8/26/2007 11:52:00 AM

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.
--
Posted via http://www.ruby-....

43 Answers

Hank Gong

8/26/2007 12:01:00 PM

0

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

On Aug 26, 8:51 pm, Nick Nick <schaefe...@gmail.com> 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.
> --
> Posted viahttp://www.ruby-....


Stefan Rusterholz

8/26/2007 12:04:00 PM

0

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
--
Posted via http://www.ruby-....

Nick Nick

8/26/2007 12:17:00 PM

0


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.
--
Posted via http://www.ruby-....

Phlip

8/26/2007 2:22:00 PM

0

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

--
Phlip
http://www.oreilly.com/catalog/9780...
"Test Driven Ajax (on Rails)"
assert_xpath, assert_javascript, & assert_ajax


Phrogz

8/26/2007 2:26:00 PM

0

On Aug 26, 6:16 am, Nick el <schaefe...@gmail.com> 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?

Phlip

8/26/2007 2:57:00 PM

0

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.

--
Phlip
http://www.oreilly.com/catalog/9780...
"Test Driven Ajax (on Rails)"
assert_xpath, assert_javascript, & assert_ajax


Ari Brown

8/26/2007 3:24:00 PM

0


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

> On Aug 26, 6:16 am, Nick el <schaefe...@gmail.com> 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

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

8/26/2007 4:03:00 PM

0

|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. 2007-08-26T20:01


Lionel Bouton

8/26/2007 4:14:00 PM

0

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.

Phlip

8/26/2007 4:22:00 PM

0

Lionel Bouton 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...

--
Phlip
http://www.oreilly.com/catalog/9780...
"Test Driven Ajax (on Rails)"
assert_xpath, assert_javascript, & assert_ajax