Hi Dan,

I see rather different picture here (Vista x64, latest JRuby, JDK 1.6).

Essentially, for such small numbers (BIG == 2**6), JRuby is *MUCH*
faster than MRI:
0.4sec vs 1 sec

But when you start increasing the BIG value, MRI is slowing down not
as fast as JRuby.

Eventually, around 2**35, the speeds are about the same: 1.5 secs.

The bigger the value the bigger the difference between MRI and JRuby.

Looking at the profiling data, most of the time in JRuby spent in
BigInteger.pow method.

I guess, that's the tradeoff the implementors of BigInteger made: fast
at smaller and more commonly
used values, slow on big values.

In in some places in there BigInteger/BigDecimal, there are *VERY*
inefficient things performed,
like filling array with zeroes and then parsing them to obtain the big
values, etc.

Thanks,
  --Vladimir


On Wed, Jun 11, 2008 at 4:39 AM, Daniel Berger <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Ruby 1.8.6-p111
> JRuby 1.1.2
> Java 1.6
> Windows XP
>
> I ran some Rational benchmarks and JRuby beat MRI on all benchmarks.
>
> Except one - Bignum#rpower:
>
> MAX = 300000
> BIG = 2**6
> NUM = 27
>
> Benchmark.bm(25) do |x
>   x.report("Bignum#rpower"){
>      MAX.times{ BIG.rpower(NUM) }
>   }
> end
>
> Here are my results:
>
> C:\>ruby bench_rational.rb
>                               user     system      total        real
> Bignum#rpower              3.594000   0.031000   3.625000 (  3.704000)
>
> C:\>jruby bench_rational.rb
>                               user     system      total        real
> Bignum#rpower              6.750000   0.000000   6.750000 (  6.749866)
>
> JRuby generally does very well with numeric calculations. I'm curious why
> it's slower in this particular instance.
>
> Regards,
>
> Dan
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to