ruby vs. java?

R

Ralf Müller

that is strange, i always thought that octave was the name of the big sgi
box. havent these gnu guys been accused by sgi yet?
thank you for the link, but i dont like it. it is to much like fortran for
me. they say that when you know fortran you can learn octave in a few hours.
i think fortrans time is over. and besides, what shall my professor say when
i come up with a fortran program?

Sorry, but for numerical solutions Fortran is still a standard. That's why there are Fortran 95 and Fortran 99.

I wonder why Fortran seems strange to you; you're are a physician. Most of the physicians i know use either Fortan or C.

ralf
 
R

Robert Klemme

Franz said:
Hello Robert,


S**preiß damischer ;-) ! Wos wuisch? (<= Sorry to, but that is how we
bavarians react on other germans)
LOL

A Preiß is Nice, but a Bayer is Higher.

(A German, pardon: Bavarian, proverb of doubtful quality)
there is not one vb book which is <1000 sides and everything goes like
this.object.has.another.property.than(the.other.object.which.we.talk.about
)...
and you can program excel & word with it. thats what i think, maybe i
should use an excel sheet and do the programming with vb. or is their
something like ruby for excel?

I know that people have undertaken to use Ruby to control Excel before
(there were some requests about this). You might find them by searching
the archives:
http://blade.nagaokaut.ac.jp/ruby/ruby-talk/index.shtml
Why is vb not a fast language? I have read statistics who say that
you can program in vb 10x as faster than in c/c++.

Well yes, but the software will likely run faster in C or C++.
i dont know, i
cant c and i dont like it too. /must/ i write an extension to do math
in ruby?

No, if one of the existing extensions does what you need.
how fast can java be? depends this not on the browser?

??? Java is not only for applets. Of course the speed depends on the
hardware, operating system and algorithms used - as always. :)
and what is RAA? i guess some archive but where can i find it?
http://raa.ruby-lang.org/


Is this good? Can we say: Less code => run faster?

Unfortunately it's not that easy. But: less code => less time to program
and less errors.
Oh, dont you worry about the library, i think i have all the
necessary math books on my shelf.
What is IDE? http://en.wikipedia.org/wiki/Integrated_development_environment


I dont too, so there is at least one thing we have common. I think we
will be friends, if if you are a Preiß :) .

*gggg*

Servus

robert
 
J

Jim Freeze

* Jim Freeze <[email protected]> [2005-05-11 20:59:42 +0900]:

Let me point out one other thing. If you start with
f = 1.0

instead of
f = 1

that is, floating pt math instead of integer math, you get:
% ruby fac 7500
0.03094
0.038541
0.068006
% ruby fac 17500
0.066106
0.075447
0.128814
% ruby fac 27500
0.10868
0.113806
0.198435
% ruby fac 7500
0.498884
0.337408
0.283017 # this is faster than #2
% ruby fac 17500
2.375539
2.075047
2.111601 # looks like a GC happened. Used to be faster.
% ruby fac 27500
5.997851
5.749802
5.797634

% cat fac
def fac1( n )
f = 1
(1..n).each { |x| f *= x }
return f
end

def fac2( n )
f = 1
(1..n).each { |x| f *= x }
end

def fac3( n )
(1..n).inject(1) { |f,x| f * x }
end

start = Time.now
fac1( ARGV[0].to_i )
puts Time.now - start

start = Time.now
fac2( ARGV[0].to_i )
puts Time.now - start

start = Time.now
fac3( ARGV[0].to_i )
puts Time.now - start
 
M

Michael Ulm

Franz Hartmann wrote:

Franz,
I have myself somehow tested this and unfortunately, ruby shall not
take advantage of the dual CPU. The example I used for this was the
calculation of the factorial of 100000. This is IMHO a good example to
discuss the performance question.


Yes, and i am schocked... i have a pentium 3 box (900 mhz) which give me
1800 mips and it needs 14 min 43 secfor the calculation of 100000
multiplications.
14 x 60 + 43 sec = 883 sec
100000 operations / 883 sec = 113 flops???
c64 basic calculated 10000 sqrts within less than 20 minutes, that
amount to 10000 / 1200 = 8 flops. at 0.9 mhz, that is 1/1000.
(8 / 113) / (0.9 / 900) = 70.8
Does this mean that ruby is 70 (seventy) times slower than c64 basic,
not counting the advantages of 32 vs 8 bit????
Or did i just make some very stupid error? Here's the program:


def fac( n )
f = 1
(1..n).each { |x| f *= x }
return f
end

print "%d\n" % fac( ARGV[0].to_i )

Ruby may be slow, but not that slow. In your computation, you did
not do floating point computations, but arbitrary size integer
computations. Multiplication of an ~100000 digit integer by another
integer is quite costly. Therefore it took so long.

Here is a test for floating point operations:

def harm(n)
(1..n).inject(1.0) {|a, b| a + 1.0 / b}
end

which computes the n'th harmonic number (1 + 1/2 + 1/3 + ... + 1/n).

harm(100000) takes about 1 second on my system.

xyzzy,

Michael

--
Michael Ulm
R&D Team
ISIS Information Systems Austria
tel: +43 2236 27551-219, fax: +43 2236 21081
e-mail: (e-mail address removed)
Visit our Website: www.isis-papyrus.com
 
F

Franz Hartmann

Ralf,
From: Ralf Müller <[email protected]>
Reply-To: (e-mail address removed)
To: (e-mail address removed) (ruby-talk ML)
Subject: Re: ruby vs. java?
Date: Wed, 11 May 2005 20:59:59 +0900



Sorry, but for numerical solutions Fortran is still a standard. That's why
there are Fortran 95 and Fortran 99.

nightmare - to be continued ;-)
I wonder why Fortran seems strange to you; you're are a physician. Most of
the physicians i know use either Fortan or C.

no i am not, and physicians rarely use any programming language, because
Virchow got along without any computer at all.
(physician = Arzt, physicist = Physiker) :)))

Franz

_________________________________________________________________
Eine für alle. MSN Suche. http://search.msn.de Finden statt suchen!
 
M

Michael Ulm

Michael said:
Here is a test for floating point operations:

def harm(n)
(1..n).inject(1.0) {|a, b| a + 1.0 / b}
end

Correction:
that should be

def harm(n)
(1..n).inject(0.0) {|a, b| a + 1.0 / b}
end

--
Michael Ulm
R&D Team
ISIS Information Systems Austria
tel: +43 2236 27551-219, fax: +43 2236 21081
e-mail: (e-mail address removed)
Visit our Website: www.isis-papyrus.com
 
R

Ralf Müller

(physician = Arzt, physicist = Physiker) :)))
DAMN!
sorry, my fault


but how did you came across fluid dynamics as ARZT (damndamndamn)
 
J

Jason Foreman

Random thoughts related to this topic:

+1 for ForTran. Learn to love it.

The SGI box is the Octane, not the Octave.

Don't start this project in ruby, because when your program takes 3
months to run you'll just rewrite it in ForTran anyway...

Repeat after me: "I will not use Visual Basic. I will NOT use Visual Basic=
"

Don't force an Object Oriented design onto your numerical analysis
problem unless there is good reason too do so. You'll shoot yourself
in the foot before you even get started.

Java does not run only in a web browser, and its speed is certainly
not related to running in a browser. But it's not the right tool for
this job either.

Less code !=3D faster code.

Mathematica would probably work too, if you can afford it or your Uni
has it available.


Jason
 
G

Glenn Parker

Franz said:
Okay, everyone except for you, $\infty - 1$ :)

Nor do I. OO code may be faster to write (and re-write), but it has
never been faster to execute. On average, OO code execution speed is
very similar to non-OO code. On top of that, Ruby is dynamically typed,
unlike TurboPascal or C++ or VB, which adds more execution-time
overhead. Finally, the current Ruby interpreter has sub-optimal
performance because it is still rather new compared to mature languages
like Smalltalk.

Real numerical simulations (as opposed to toy projects) demand efficient
use of hardware resources, and they do not benefit as much from the OO
design style. All this makes Ruby a poor choice, unless you are just
playing around.
Uuargh! must i?

It sounds like you have already made up your mind, so why ask?
 
C

Cameron McBride

Sorry, but for numerical solutions Fortran is still a standard. That's wh=
y there are Fortran 95 and Fortran 99.

well, I don't know about that. It's still around a lot, but I'm not
sure I want to jump to calling it a standard. I know people that
still PROGRAM IN ALL CAPS ("lowercase is for comments"), but that
doesn't mean it's a practice I endorse.

I like interpreted languages for development speed, but they can be
computationally slow. First off, GSL is pretty handy - and can solve
a lot of speed issues along with providing adequate libraries
(http://rb-gsl.rubyforge.org/). Franz, you don't sound like you know
C, but one of the beauties of ruby is it's ease of C binding. If you
need to make some routine fast, you can just spend time on that bit,
and return to ruby once it's done. Here, RubyInline can make things go
even faster (http://rubyforge.org/projects/rubyinline/).

Cameron
 
C

Cameron McBride

Random thoughts related to this topic:

and some random responses.
+1 for ForTran. Learn to love it.

no. I'll interface when necessary, but love it? heh. no.
Don't start this project in ruby, because when your program takes 3
months to run you'll just rewrite it in ForTran anyway...

Who is this "Tran" you speak of, and why do you write For them? ;)

how many small scientific programs really grow up into projects? What
I've noticed is that a lot of scientific programs actually skip a lot
of the test / usage cycle. Using a simplier programming language
(interpreted) might help you a lot in the design and tweak stages. To
pound cliches, "you spend less time creating scaffolding for the
language".
Repeat after me: "I will not use Visual Basic. I will NOT use Visual Bas=
ic."

Good man. This I endorse.
Java does not run only in a web browser, and its speed is certainly
not related to running in a browser. But it's not the right tool for
this job either.

actually, that might not be true. I saw some very smart people talk
about making Java useful for some big tasks.
http://www.cs.berkeley.edu/Research/Projects/titanium/
http://www.siam.org/meetings/pp04/yelick.htm

I just think ruby is far nicer, and more appropriate to the scale I'm
dealing with.

Cameron
 
J

James Britt

Franz said:
Hello all,

just call me Franz. I study physic in Berlin, but i am from bavaria
(that is in the south of germany).

That's the best part.

(Meine Frau ist von Kempten, in Allgäu)

James
 
J

James Edward Gray II

can ruby handle two processors?

Not really, no. Ruby's threads are non-native, so they can't take
advantage of Mac OS X's scheduler. Other things can be run on the
other processor while Ruby is running, but Ruby itself will not run
on both (excepting programs that call fork()).
btw, i know this is a ruby list but is their any way to run windows
programs on mac?

Yes, with an emulator. Virtual PC is the best choice here. Be
warned though, this process of emulating an operating system inside
another operating system is a massive resource drain. Everything you
do in the Window's environment will suffer greatly and some things
are simply impossible or at least impractical.

If you need to run a lot of Windows' software, you're going to want a
Windows machine, in my opinion.

James Edward Gray II
 
J

Jim Weirich

Glenn Parker said:
Real numerical simulations (as opposed to toy projects) demand efficient
use of hardware resources, and they do not benefit as much from the OO
design style. All this makes Ruby a poor choice, unless you are just
playing around.

The Kali code project seems to be using Ruby to do dense stellar system
modeling. Chapter 12 where they address speed issues is still incomplete,
but they talk about timing issues and C code libraries. All in all, an
interesting read (I'm slowing working through it).
 
J

Joel VanderWerf

Ralf said:
Well...

it depends on what you mean by 'the best programming language for this'?
Should it be fast? or have beautiful code? Should it be extensible? Do you want to rely on existing libraries?

I did some numerical analysis in geophysics and it took 1-7 days to get the results. So, you should keep in mind how expensive you number crunching will be. Maybe a week is to long for you.

btw: there is a 'Runge-Kutta Ruby Class' avaliable, search freshmeat

regards
ralf

Ruby is working out pretty well for numerical simulations for my work,
but that depends heavily on using C code generation to produce fast code
to perform rk4 (Runge-Kutta 4th order) evaluations. Speeds ends up a
factor of two slower than, say, Matlab, but that's not because of ruby,
it's because we're not doing pure ODEs, but hybrid ODEs with state
changes, reconfigurable dataflow, and guards that have to be checked at
every timestep.

If you're willing either to write a core of C code or to write a code
generator, then you can probably keep 90% or 95% of the rest of your
code (GUI, input/output processing, file handling, etc.) in ruby and be
happier overall.
 
D

Dick Davies

* Franz Hartmann said:
that is strange, i always thought that octave was the name of the big sgi
box. havent these gnu guys been accused by sgi yet?

that's an Octane.
 
D

Dibya Prakash

Hi,
I definitely agree "NO VB".My preferrence would be C++.It will give u
a good mathematical support.

the results. So, you should keep in mind how expensive you number crunchin=
g will be. Maybe a week is to long for you.
 
J

Jeremy Tregunna

that is strange, i always thought that octave was the name of the big
sgi box. havent these gnu guys been accused by sgi yet?
thank you for the link, but i dont like it. it is to much like fortran
for me. they say that when you know fortran you can learn octave in a
few hours. i think fortrans time is over. and besides, what shall my
professor say when i come up with a fortran program?

You may be thinking of "Octane" or "Origin". SGI has no machine called
"Octave".
 
F

Franz Hartmann

let me explain honey :) :
franz.study.name == "physic"
franz.study.comprise( "fluid dynamics" ) == "Yes"
From: Ralf Müller <[email protected]>
Reply-To: (e-mail address removed)
To: (e-mail address removed) (ruby-talk ML)
Subject: Re: ruby vs. java?
Date: Wed, 11 May 2005 21:31:27 +0900

DAMN!
sorry, my fault


but how did you came across fluid dynamics as ARZT (damndamndamn)

_________________________________________________________________
MSN Hotmail. Anmelden und gewinnen! http://www.msn.de/email/webbased/ Ihre
Chance, eines von 10 T-Mobile MDA II zu gewinnen!
 
R

Ralf Müller

let me explain honey :) :
franz.study.name == "physic"
franz.study.comprise( "fluid dynamics" ) == "Yes"

And your prof would be shocked by fortan?
I'm curious which language he use for simulation?

ralf
 

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,122
Latest member
VinayKumarNevatia_
Top