[Nolug] Bigger number, faster computation...

From: Ron Johnson <ron.l.johnson_at_cox.net>
Date: Thu, 01 Jul 2004 02:33:50 -0500
Message-Id: <1088667230.29741.17.camel@haggis.homelan>

On Wed, 2004-06-30 at 22:02 -0500, Alex McKenzie wrote:
> Ron Johnson wrote:
> > On Wed, 2004-06-30 at 16:43 -0500, Brad Bendily wrote:
> >
> >>>It took about 15 minutes on my Athlon(tm) XP 2200+. Shoulda
> >>>timed it.
> >
> >
> > $ time python -c 'print str(2**3000000)'
> >
> > real 14m15.753s
> > user 13m1.612s
> > sys 0m0.606s
> >
> >
> >>I have a P4 1.4 Ghz machine. I was doing a few other things at the time
> >>too...
> >>
> >>
> >>Wed Jun 30 15:49:54 CDT 2004
> >>903090
> >>Wed Jun 30 16:23:23 CDT 2004
> >>
> >>
> >>33 minutes!
> >
> >
> This is with an Athlon 750, 768MB@PC133, using 85% cpu with the other
> bit for F@H
>
> $ time python -c 'print str(2**3000000)'
> 903090
>
> real 37m25.302s
> user 32m4.510s
> sys 0m0.000s
>
> Hmmm....should I spend the $60 to upgrade?

Oddly, when I did a "python -c 'print str(2**3000001)'", it took:
  real 12m28.495s
  user 12m17.516s
  sys 0m0.087s

That's *faster* than 2**3000000. Very odd.

Here's something else interesting (not good nor bad, but interest-
ing) about python - delayed execution:
  $time python -c 'a = 2**3000001'
  
  real 0m0.139s
  user 0m0.109s
  sys 0m0.013s

I figured it was a bug, so I tried it from the interactive python
chevron prompt, and "a = 2**3000001" returned instantly, too.
However, when I decided to "print a", that's what takes a long
time.

-- 
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l.johnson@cox.net
Jefferson, LA USA
"Why should we not accept all in favor of woman suffrage to our
platform and association even though they be rabid pro-slavery
Democrats."
Susan B. Anthony, _History_of_Woman_Suffrage_
http://www.ifeminists.com/introduction/essays/introduction.html
___________________
Nolug mailing list
nolug@nolug.org
Received on 07/01/04

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