Subject: long mult.multiply runtime

From: micah craig <[email-masked]>
Date: Tue, 07 Dec 1999 13:55:57 -0500

I'm getting unexpected behavior on the multiply test.  I'm getting an
average runtime of between 250ms and 300ms using Archi's mult.multiply()
routine versus around 0.02ms using the standard java
BigInteger.multiply() method.  I time the averaging loops exactly the
same, and when I replace the mult.multiply() call with a
BigInteger.multiply() call I get similar results from both tests, as one
would expect.  (In other words, the problem is not in the timing.)  This
is using JDK1.1.7 on Solaris.  I believe this came up in lecture, and
was written off as a problem with garbage collection, but I am getting
these results consistently.  Are other people running into this as
well?  Any fixes?  Thanks.
-- 
"Punch it Chewey!"
  - Han

---

From: Chee Yap <[email-masked]>
Date: Wed, 8 Dec 1999 08:23:41 -0500 (EST)

> Date: Tue, 7 Dec 1999 18:28:08 -0500 (EST)
> From: Archisman Rudra <[email-masked]>
> To: Joaquin Grech <[email-masked]>
> cc: Chee Yap <[email-masked]>, [email-masked]
> Subject: Re: long mult.multiply runtime
> 
>    This is a little odd. Check your code to see that you are calculating
> the average correctly. On my machine it looks ok at those values....
> 
> I have seen some students divide by numBits to get the average, whereas
> you sould divide by number of trials....
> 
> My command line:
> 

Let N = number of trials.
As I suggested in the Hints (see hw5 webpage),
do not divide by N either.
Moreover, you should run each multiplication
for N times in a tight loop.  Do not
try to time individual runs.
I think this is better (unless garbage
collection occurs).

Chee