Re: [Nolug] In case you wanted to know how big 2 to the 3,000,000 is...

From: Ron Johnson <ron.l.johnson_at_cox.net>
Date: Thu, 01 Jul 2004 20:57:54 -0500
Message-Id: <1088733474.5345.15.camel@haggis.homelan>

On Thu, 2004-07-01 at 20:32 -0500, Ron Johnson wrote:
> On Thu, 2004-07-01 at 14:08 -0500, Friedrich Gurtler wrote:
> > >
> > >
> > >I tried it in perl, the output i got was 3.
> > >
> > >3 is the length of the string 'inf', hahaha...
> > >
> > >ray
> > >
> >
> > >Surprise..... 131 seconds. (Roughly under 3 minutes.)
> > >
> > >I got the same result
> > >length: 903090
> > >time: 131
> > >
> >
> > I tried it in perl too, but got rather different results.
> >
> > use Math::BigInt lib=>'GMP';
> > print Math::BigInt->new('1')->blsft(3000000, 2)->length() ."\n";
> >
> > fritz $ time perl test.pl
> > 903090
> >
> > real 0m10.035s
> > user 0m8.320s
> > sys 0m0.160s
> >
> > 10 seconds on a 667 Mhz Mac. It is all about how smart your algorithm
> > is. (Or perhaps Macs are that powerful! ;-) )
>
> 10 seconds, eh? What's that Mac running??
>
> $ uname -srm
> Linux 2.6.6 i686
>
> $ cat bignum.pl
> use Math::BigInt lib=>'GMP';
> print Math::BigInt->new('1')->blsft(3000000, 2)->length() ."\n";
>
> time perl bignum.pl
> 903090
>
> real 184m8.801s
> user 181m28.241s
> sys 0m1.110s

Wow!!!!!!!

I installed perl bindings for the GNU MP library, and the timing
dropped to:
  $ time perl bignum.pl
  903090
  
  real 0m2.071s
  user 0m2.012s
  sys 0m0.020s

-- 
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l.johnson@cox.net
Jefferson, LA USA
"Fear the Penguin!!"
___________________
Nolug mailing list
nolug@nolug.org
Received on 07/01/04

This archive was generated by hypermail 2.2.0 : 12/19/08 EST