speedup help

Bill Wood wtwjek@winternet.com
Sat, 08 Mar 2003 02:26:13 -0600


  . . .
> 
> > Oleg's blew the heap at 847; mine valiantly struggled on 'til it blew
> > the heap at 1910.
> 
> Hmm, I managed to compute bernoulli 2000 and even bernoulli 3000. The
> code is included. It took 7 minutes (2GHZ Pentium IV, 1GB memory) to
> compute bernoulli 2000 and 33 minutes for bernoulli 3000. I monitored
> the memory usage of the compiled application using top and found that
> the resident set stayed at 30MB, which is a little bit less than the
> resident set for Emacs. My emacs has a dozen of open windows, and has
> been running for a month. Just for the record, here's the result of
> bernoulli 3000:
> 
> (-2891939 ...6744 other digits... 81) % 12072109463901626300591430

Well, kudos to Oleg!  I just ran his code from the msg this one replies
to and got similar results:  On a 650 Mhz Athlon with 128MB RAM I
compiled with "ghc -O" (GHC 5.00.1).  Using the "time" command,
bernoulli 2000 took 490 sec. user time while bernoulli 3000 took 2170
sec.
user time.  Notice there were no heap overflows this time.  I hope
someone can explain the differences in space behavior between the
version
in Oleg's mail of March 6 and this version.  I'm surprised we are as
close
as we are in time given that my processor is less than half as fast.  I
would also expect that my having 1/8-th the memory he has would slow me
down more due to page faulting.

The current version also fixes a minor glitch: the earlier version gave
B_0 = 0 instead of 1.

I think I got the right results for B_3000: My print-out had the same
denominator along with a 6762-digit numerator with the same initial
seven and final two digits.  I don't get 6744 digits in the middle,
however.

I'm impressed by the good performance characteristics of high-level
Haskell code.

Nice work Oleg,

 -- Bill Wood
    wtwjek@winternet.com