Ruby Vs. Java

Isaac Gouy wrote:

Now my impression is that I misunderstood how different JRuby
characteristics are from Java. I suspect that whenever you mention
"adaptive optimization" or HotSpot, I'll get confused about what JRuby
is actually doing (and in-any-case JRuby is going to be doing things
differently in future).

You should know better than to post code snippet timings :slight_smile:
What if you have:

t = Time.now
looper
puts Time.now - t
t = Time.now
looper
puts Time.now - t
...

This would produce results roughly like the second version. The key point is to have the same physical code called multiple times.

As for the alioth shootout / benchmarks game, we don't re-run in a
loop because Clean and Haskell compilers notice that once around the
loop is enough to get the answer :slight_smile:

(When we poked at JVM in the FAQ, the "started once" examples are just
like your SCRIPT2 - main renamed test, and called within a timing
loop.)

That sounds good then. I'll be looking forward to the next run against JRuby 1.1 when we get it finished :slight_smile:

- Charlie

I. P. wrote:

>Phrogz>

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

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

···

On 8/26/07, I. P. <stack.tcpip@rambler.ru> wrote:

>Phrogz>

> 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 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
  Test Driven Ajax (on Rails) [Book]
  "Test Driven Ajax (on Rails)"
  assert_xpath, assert_javascript, & assert_ajax

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

Michael Glaesemann
grzm seespotcode net

···

On Aug 26, 2007, at 11:13 , Lionel Bouton wrote:

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

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

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

···

On Aug 26, 2007, at 6:33 PM, Michael Glaesemann wrote:

On Aug 26, 2007, at 11:13 , Lionel Bouton 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.

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.
---------------------------------------------------------------------------
You've got a point there. That just revised my thinking.

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!

···

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

Michael Glaesemann wrote:

···

On Aug 26, 2007, at 11:13 , Lionel Bouton 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.

You had zeros? I worked for a company that could not afford zeros. We
had to use the letter "O".
--
Posted via http://www.ruby-forum.com/\.

Lag is also largely caused by a DoS of packets to the server. Want a fix? Use multiple servers (like WoW), and get LOTS of bandwidth.

---------------------------------------------------------------|
~Ari
"I don't suffer from insanity. I enjoy every minute of it" --1337est man alive

···

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

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.

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

···

On 26/08/07, Xavier Noria <fxn@hashref.com> wrote:

On Aug 26, 2007, at 6:33 PM, Michael Glaesemann wrote:

>
> On Aug 26, 2007, at 11:13 , Lionel Bouton 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.

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

--
best,
                        UG
---
Uma Geller

In the olden days, programs used to be a combination of assembly and a
low level compiled language like C or Pascal. Lotus was actually
written wholly in assembler back in the day. The comparison of C to
assembler was, in the early days, much like the comparison of Java to
Ruby today. However, the speed comparison of assembler to C did not
sustain its original conclusion for long. As compilers improved, it was
possible to wrote wholly in C and have it execute faster than in pure
assembler.

Personal anecdote #1: actual testing

I was working at Quantum at the time (hard disk maker) and this very
controversy arose. The managers listened to the philosophical debate
for a while and decided to settle it. We had volunteers from each side
to write code in their idiom doing theoretical and practical tests of
speed. By theoretical I mean do <this thing> X times and see how fast
it is. By practical, I mean that you had to see how many seeks,
read/writes, etc you could get in a certain time with the different
algorithms.

The pure language, no assembler, won hands down.

Personal anecdote #2: compiler comparisons

I was a sysop on compuserve for the Borland topics for a while and this
came up again in various threads. There were several assembler devotees
that were pushing their notions. They maintained that they could write
an assembler routine that was fewer lines than anything that a compiled
language could manage. They tried several examples. In each case,
someone wrote a pascal method, compiled it, then looked at the generated
assembler and posted it. The compiled version was always shorter than
the one written in assembler.

Does this prove that it will always be so? Nah. It proves that trying
to out compile the compiler these days is waste. You MAY get one line
less here or there but only with tremendous effort, so why bother? Is
assembler useless? Nah, but its reputation is overrated.

What does this mean in this context?

The speed of execution is not as simple as looking at the stopwatch.
With hardware prices coming down down down, you can get muscle machines
to pick up any such slack. But, that costs money. Well, so does
development. If you can develop a lot faster in Ruby, is it worth it to
get another machine and run some of the parts in threads that will get
it done in faster fashion? If it is not, then speed may not be as
critical as you think.

There are many ways to get things moving faster. Here is one I saw
recently that I consider to be quite helpful. (It also has one of my
favorite lines I have ever read in a technical article:

"However, all these caching measures won't hide a basic problem: you are
performing lots of database queries, and it's harshing your mellow."

How can you top that???

In short, Java might run faster, but that should not make a difference.
You can use hardware and design to make up for that. After that is
done, it is the time to develop and maintain the code that will be what
matters most.

FWIW, and IMHO

···

--
Posted via http://www.ruby-forum.com/.

Lloyd Linklater wrote:

Michael Glaesemann 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.

You had zeros? I worked for a company that could not afford zeros. We
had to use the letter "O".

Be careful ... I understand Scott Adams is rather nasty about people
stealing his better Dilbert lines. :slight_smile: But ... in truth, although ILLIAC
I assembler did have symbolic *addressing*, it did not have symbolic op
codes ... the machine language of the system was so simple and logical
that they weren't needed.

Other notes on that bygone day -- programmers used hexadecimal notation,
but it was called "sexideciaml". And after 9 you had either K, S, N, J,
F, L or +, -, N, J, F, L. Those happened to be the right codes on the
five-hole paper tape that the Teletypes punched.

···

On Aug 26, 2007, at 11:13 , Lionel Bouton wrote:

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.

···

--
Posted via http://www.ruby-forum.com/.

> 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

Uma Geller wrote:

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

That was the previous system; only one key.

···

--
  Phlip
  Test Driven Ajax (on Rails) [Book]
  "Test Driven Ajax (on Rails)"
  assert_xpath, assert_javascript, & assert_ajax

Lloyd Linklater wrote:

In the olden days, programs used to be a combination of assembly and a
low level compiled language like C or Pascal. Lotus was actually
written wholly in assembler back in the day. The comparison of C to
assembler was, in the early days, much like the comparison of Java to
Ruby today. However, the speed comparison of assembler to C did not
sustain its original conclusion for long. As compilers improved, it was
possible to wrote wholly in C and have it execute faster than in pure
assembler.

Personal anecdote #1: actual testing

I was working at Quantum at the time (hard disk maker) and this very
controversy arose. The managers listened to the philosophical debate
for a while and decided to settle it. We had volunteers from each side
to write code in their idiom doing theoretical and practical tests of
speed. By theoretical I mean do <this thing> X times and see how fast
it is. By practical, I mean that you had to see how many seeks,
read/writes, etc you could get in a certain time with the different
algorithms.

The pure language, no assembler, won hands down.

I'm really curious about two things:

1. The processor architecture, and
2. The language.

There once was an architecture called VLIW, embodied in a
mini-supercomputer called Multiflow. This architecture was so
complicated that it literally *had* to have a compiler -- no human could
even program it, let alone optimize code for it. The compiler used a
technique called "trace scheduling" to do this.

The punchline is that the optimization problem for this beast was
NP-complete. Now *most* compiler optimization problems are NP-complete
once you express them as true combinatorial optimization, and the good
folks at Multiflow weren't oblivious to that fact. However, their
approximations were still slow relative to what simpler architectures
required, and Multiflow went out of business. They disappeared without a
trace.

<ducking>

I thought people sent him his best lines. :slight_smile: :slight_smile:

Jeremy Henty

···

On 2007-08-27, M. Edward (Ed) Borasky <znmeb@cesmail.net> wrote:

Lloyd Linklater wrote:

You had zeros? I worked for a company that could not afford zeros.
We had to use the letter "O".

Be careful ... I understand Scott Adams is rather nasty about people
stealing his better Dilbert lines. :slight_smile:

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.

···

On Aug 26, 2007, at 10:03 PM, Phlip wrote:

> 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

Uma Geller wrote:

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

That was the previous system; only one key.

M. Edward (Ed) Borasky wrote:

Lloyd Linklater wrote:

I was working at Quantum at the time (hard disk maker) and this very
controversy arose. The managers listened to the philosophical debate
for a while and decided to settle it. We had volunteers from each side
to write code in their idiom doing theoretical and practical tests of
speed. By theoretical I mean do <this thing> X times and see how fast
it is. By practical, I mean that you had to see how many seeks,
read/writes, etc you could get in a certain time with the different
algorithms.

The pure language, no assembler, won hands down.

I'm really curious about two things:

1. The processor architecture, and
2. The language.

1. It was on a 386, 16MHz with no math coprocessor. (How is THAT for
old???)

2. We were using straight C and Microsoft's 5.1 compiler on DOS 3.1 if
memory serves.

Note: I was the one that did the theoretical programming. My buddy did
the practical and he did it with a kind of a cheat. He would write
code, then look at the assembler that the compiler produced. He would
tweak the code and look again. Whatever produced the least number of
assembler lines is what he used. His code was more than an order of
magnitude faster.

Theoretical speed is somewhat like the velocity metrics on high
performance cars. Just because it goes 0-60 in 4 seconds does not mean
that you can get it to do that. It is much the same with java vs. Ruby.
Many articles I have read, and with which I agree, say that development
and maintenance are the biggest costs for most projects. Getting things
up and earning revenue as fast as possible is not to be underestimated.

···

--
Posted via http://www.ruby-forum.com/\.

"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. :>

···

--
Posted via http://www.ruby-forum.com/.