Comparison Ruby, Python, Php, Groovy ecc

Okay that table got completely screwed. I will try once more or you
may get these results here http://pastie.org/594583

Language Time for 100 iterations Times slower
than java with -server
java1.6 –server 0.18 1
Ruby1.8.7 7.78 44.07
Ruby1.9.2 4.2 23.78
Jruby 2.5
14.16
Jruby1.3.1—sever 2.31 13.1
java1.6 -client 0.18 1.01
python 2.6.2 3.04 17.21

Jruby is the fastest here with 13 times slower than java. I am sure
there
are other command line options which may allow jruby to perform faster,
that
I am not aware of. Also shows ruby1.9.2 is slower than python 2.6.2

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

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…

On Tue, Aug 25, 2009 at 5:18 PM, [email protected] wrote:

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

On Thu, Sep 3, 2009 at 7:18 AM, [email protected] wrote:

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

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

On Thu, Sep 3, 2009 at 1:11 AM, Charles Oliver
Nutter[email protected] wrote:

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