Rubinius (straight from git about an hour before this email was posted):
rbx MatrixBenchmark.rb 64
Hilbert matrix of dimension 64 times its inverse = identity? true
54.707671 0.000000 54.707671 ( 54.707674)
jRuby 1.1.3:
jruby MatrixBenchmark.rb 64
Hilbert matrix of dimension 64 times its inverse = identity? true
19.768000 0.000000 19.768000 ( 19.767100)
MRI (1.8.6, straight from Subversion about an hour before this email
was posted):
../PTR2/ruby_1_8_6.inst/bin/ruby MatrixBenchmark.rb 64
Hilbert matrix of dimension 64 times its inverse = identity? true
27.120000 1.910000 29.030000 ( 29.117242)
KRI (1.9 straight from Subversion about an hour before this email was posted):
../PTR2/ruby.inst/bin/ruby MatrixBenchmark.rb 64
Hilbert matrix of dimension 64 times its inverse = identity? true
7.910000 0.020000 7.930000 ( 7.935329)
In other news, if you're on Linux, oprofile-0.9.4 has been released.
You can get the tarball at
http://sourceforge.net/project/showfiles.php?group_id=16191.
The main Ruby-relevant feature is that it now has the capability of
profiling Java apps, including JIT-compiled code. And there's an API
for writing your own JIT profiling interface. I'm hoping to get the
Java profiling working with jRuby this weekend. Given the nature of
this benchmark, I don't see why jRuby can't run it as fast as KRI does
-- once you get up to a decent sized matrix, it should be dominated by
C-level "bignum" operations, like "gcd".
--
M. Edward (Ed) Borasky
http://pdxfoscon.org/start/
http://ruby-perspectives.blogspot.com/
"A mathematician is a machine for turning coffee into theorems." --
Alfréd Rényi via Paul Erd?s
M. Edward (Ed) Borasky <zn...@cesmail.net>
I've wondered a bit about this too, but I also have heard that KRI has a
much improved matrix.rb which makes use of some new core methods like
fdiv. I have not taken the time to incorporate the new matrix.rb and I
don't believe there's any specs for it, but it's very likely that helps
out KRI quite a bit.
Can anyone confirm that KRI has a better-designed/better-optimized
matrix.rb?
- Charlie
And I know it starts to sound like a broken record, but a cold start
generally doesn't show the best performance for JRuby. Here's my
comparative numbers going through the intermediate steps up to 64 rather
than directly to it:
JRuby:
Hilbert matrix of dimension 64 times its inverse = identity? true
16.813000 0.000000 16.813000 ( 16.813530)
KRI:
Hilbert matrix of dimension 64 times its inverse = identity? true
11.060000 0.110000 11.170000 ( 11.345526)
...a much closer margin. And you're right about mathematical
performance...in almost all benchmarks JRuby does come out at least as
fast as KRI, and often faster when we're really able to lean on the JVM.
Here's an iterative fib that goes well into Bignum territory:
JRuby:
Iterative fib(300_000)
11.252000 0.000000 11.252000 ( 11.251488)
11.018000 0.000000 11.018000 ( 11.017310)
KRI:
Iterative fib(300_000)
14.260000 4.160000 18.420000 ( 18.741837)
14.130000 4.200000 18.330000 ( 18.677012)
- Charlie
Ahh, I think I found it. It was rational that was looking for fdiv...but
the bigger boost for KRI probably comes from the fact that rational is
now implemented in C.
So we just need a rational in Java to compete :)
- Charlie
Only on this benchmark. :) It's not just Rational, by the way. It's
*bignum* Rationals, and bignum gcds.
Meanwhile, I think I have the jRuby profiling working. I don't know
jRuby internals at all, but see if this makes any sense to you. The
samples in 13728.jo are from the JIT-compiled code, I think.