Comparison Ruby, Python, Php, Groovy ecc.

B

brabuhr

http://shootout.alioth.debian.org/u32q/benchmark.php?test=mandelbrot

OpenJDK Client VM (build 14.0-b08, mixed mode, sharing)> java Bench1 > /dev/null

Java Elapsed 0.08
Java Elapsed 0.079
Java Elapsed 0.079
ruby 1.9.2dev (2009-08-25 trunk 24642) [i686-linux]> ruby -rubygems bench2.rb > /dev/null

Ruby Elapsed 0.059
Ruby Elapsed 0.058
Ruby Elapsed 0.060

I guess this wasn't the first run when the inline code got compiled?

Right, compilation time is not included. The time measurements were
taken inside the program before and after the method call.
Anyway, since the runtime is so short, in the case of the java version
you're to some extent measuring the JVM startup time.

As above, the timings are from inside the program: so, they don't
include the startup time, but the program did not allow for JIT warmup
time.
 
C

Charles Oliver Nutter

jruby 1.3.0 (ruby 1.8.6p287) (2009-06-03 5dc2e22) (OpenJDK Client VM
1.6.0_0) [i386-java]
jruby bench1.rb > /dev/null
Ruby Elapsed 4.185
Ruby Elapsed 3.760
Ruby Elapsed 3.626

Pass --server for best performance. Additionally pass --fast to turn
on experimental optz.
jruby 1.3.0 (ruby 1.8.6p287) (2009-06-03 5dc2e22) (OpenJDK Client VM
1.6.0_0) [i386-java]
jruby -rubygems bench2.rb > /dev/null
Ruby Elapsed 0.409
Ruby Elapsed 0.410
Ruby Elapsed 0.412

Ditto. CPU-intensive code will often be as much as 2x faster with --server.

- Charlie
 
L

Lui Kore

It's unfair, result of this program can be determined at compile time,
the haskell one would be fastest ( if there is one :)

JVM makes plenty of optimizations before it runs program, while starts
very slow. Scripts are faster if startup time is taken into
consideration.

btw, Ruby doesn't have a "char" type, doing a "char" print is of course
much slower...
 
B

brabuhr

jruby 1.3.0 (ruby 1.8.6p287) (2009-06-03 5dc2e22) (OpenJDK Client VM
1.6.0_0) [i386-java]
jruby bench1.rb > /dev/null
Ruby Elapsed 4.185

Pass --server for best performance. Additionally pass --fast to turn
on experimental optz.
jruby 1.3.0 (ruby 1.8.6p287) (2009-06-03 5dc2e22) (OpenJDK Client VM
1.6.0_0) [i386-java]
jruby -rubygems bench2.rb > /dev/null
Ruby Elapsed 0.409

Ditto. CPU-intensive code will often be as much as 2x faster with --server.

One of the machines I tested on only had the client vm, so I didn't
include those numbers from the other machines either. However,
--server and --fast on the other machines didn't make much of an
impact on this short test: varying from a nice speed boost on some
runs to slower on others (the test program did not do any pre-test
warmup).
 
C

Charles Oliver Nutter

er.

One of the machines I tested on only had the client vm, so I didn't
include those numbers from the other machines either. =C2=A0However,
--server and --fast on the other machines didn't make much of an
impact on this short test: varying from a nice speed boost on some
runs to slower on others (the test program did not do any pre-test
warmup).

May simply be too short of a test, or the bottleneck isn't in
execution...but I'm sure with some poking around we could get JRuby to
have the fastest result.

- Charlie
 

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,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top