Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Multiplication with zero

Reply
Thread Tools

Multiplication with zero

 
 
logiclips@yahoo.com
Guest
Posts: n/a
 
      02-06-2007
Hi,

I'm having a dataset which I use to multiply with another dataset. The
number of multiplications is >5000 but constant.
The time for computing varies (~0.1-0.2 s) for different datasets,
although they are of the same size. What is the reason for this
variation? Is it because of the zeros that are in the dataset such
that multiplication with zero is faster than any other multiplication.
So the more zeros the faster? Or is it maybe a memory problem?

Thanks,

Peter Vermeer

 
Reply With Quote
 
 
 
 
Patricia Shanahan
Guest
Posts: n/a
 
      02-06-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi,
>
> I'm having a dataset which I use to multiply with another dataset. The
> number of multiplications is >5000 but constant.
> The time for computing varies (~0.1-0.2 s) for different datasets,
> although they are of the same size. What is the reason for this
> variation? Is it because of the zeros that are in the dataset such
> that multiplication with zero is faster than any other multiplication.
> So the more zeros the faster? Or is it maybe a memory problem?


There are all sorts of effects that could give a 0.1 second variation in
time unless you have things really well locked down.

Do repeated runs with the same dataset take the same amount of time? In
particular, try alternating runs with a "fast" and a "slow" data set.

Patricia
 
Reply With Quote
 
 
 
 
logiclips@yahoo.com
Guest
Posts: n/a
 
      02-06-2007
On 6 Feb., 14:31, Patricia Shanahan <(E-Mail Removed)> wrote:
> (E-Mail Removed) wrote:
> > Hi,

>
> > I'm having a dataset which I use to multiply with another dataset. The
> > number of multiplications is >5000 but constant.
> > The time for computing varies (~0.1-0.2 s) for different datasets,
> > although they are of the same size. What is the reason for this
> > variation? Is it because of the zeros that are in the dataset such
> > that multiplication with zero is faster than any other multiplication.
> > So the more zeros the faster? Or is it maybe a memory problem?

>
> There are all sorts of effects that could give a 0.1 second variation in
> time unless you have things really well locked down.
>
> Do repeated runs with the same dataset take the same amount of time? In
> particular, try alternating runs with a "fast" and a "slow" data set.
>
> Patricia


Well the problem is that I have only the results of the different
datasets but I'm not able to test these anymore.
BTW the total amount of processing time is approx 3.5 sec.
Could the things mentioned above be a reason for the time variance?

 
Reply With Quote
 
Oliver Wong
Guest
Posts: n/a
 
      02-06-2007
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> On 6 Feb., 14:31, Patricia Shanahan <(E-Mail Removed)> wrote:
>> (E-Mail Removed) wrote:
>> > Hi,

>>
>> > I'm having a dataset which I use to multiply with another dataset. The
>> > number of multiplications is >5000 but constant.
>> > The time for computing varies (~0.1-0.2 s) for different datasets,
>> > although they are of the same size. What is the reason for this
>> > variation? Is it because of the zeros that are in the dataset such
>> > that multiplication with zero is faster than any other multiplication.
>> > So the more zeros the faster? Or is it maybe a memory problem?

>>
>> There are all sorts of effects that could give a 0.1 second variation in
>> time unless you have things really well locked down.
>>

[...]
>
> Could the things mentioned above be a reason for the time variance?


Yes.

- Oliver


 
Reply With Quote
 
Greg R. Broderick
Guest
Posts: n/a
 
      02-06-2007
(E-Mail Removed) wrote in
news:(E-Mail Removed) oups.com:

> On 6 Feb., 14:31, Patricia Shanahan <(E-Mail Removed)> wrote:
>> (E-Mail Removed) wrote:
>> > Hi,

>>
>> > I'm having a dataset which I use to multiply with another
>> > dataset. The number of multiplications is >5000 but constant.
>> > The time for computing varies (~0.1-0.2 s) for different
>> > datasets, although they are of the same size. What is the reason
>> > for this variation? Is it because of the zeros that are in the
>> > dataset such that multiplication with zero is faster than any
>> > other multiplication. So the more zeros the faster? Or is it
>> > maybe a memory problem?

>>
>> There are all sorts of effects that could give a 0.1 second
>> variation in time unless you have things really well locked down.
>>
>> Do repeated runs with the same dataset take the same amount of
>> time? In particular, try alternating runs with a "fast" and a
>> "slow" data set.
>>
>> Patricia

>
> Well the problem is that I have only the results of the different
> datasets but I'm not able to test these anymore.
> BTW the total amount of processing time is approx 3.5 sec.


If you're trying to significantly speed up that 3.5 seconds, then I'd
suggest that attempting to optimize an operation that will, at best,
result in a 0.2 second improvement is a less-than-optimal use of your
time -- there are undoubtedly other optimizations that could result in
greater speed improvement.

Cheers
GRB

 
Reply With Quote
 
logiclips@yahoo.com
Guest
Posts: n/a
 
      02-07-2007
On 6 Feb., 20:59, "Greg R. Broderick" <gregb
(E-Mail Removed)> wrote:
> (E-Mail Removed) wrote innews:(E-Mail Removed) groups.com:
>
>
>
> > On 6 Feb., 14:31, Patricia Shanahan <(E-Mail Removed)> wrote:
> >> (E-Mail Removed) wrote:
> >> > Hi,

>
> >> > I'm having a dataset which I use to multiply with another
> >> > dataset. The number of multiplications is >5000 but constant.
> >> > The time for computing varies (~0.1-0.2 s) for different
> >> > datasets, although they are of the same size. What is the reason
> >> > for this variation? Is it because of the zeros that are in the
> >> > dataset such that multiplication with zero is faster than any
> >> > other multiplication. So the more zeros the faster? Or is it
> >> > maybe a memory problem?

>
> >> There are all sorts of effects that could give a 0.1 second
> >> variation in time unless you have things really well locked down.

>
> >> Do repeated runs with the same dataset take the same amount of
> >> time? In particular, try alternating runs with a "fast" and a
> >> "slow" data set.

>
> >> Patricia

>
> > Well the problem is that I have only the results of the different
> > datasets but I'm not able to test these anymore.
> > BTW the total amount of processing time is approx 3.5 sec.

>
> If you're trying to significantly speed up that 3.5 seconds, then I'd
> suggest that attempting to optimize an operation that will, at best,
> result in a 0.2 second improvement is a less-than-optimal use of your
> time -- there are undoubtedly other optimizations that could result in
> greater speed improvement.
>
> Cheers
> GRB


Actually I don't want to speed it up. I just want to know why these
variations exist although the operations are always the same.

Thanks,
Peter

 
Reply With Quote
 
pascal.lecointe@euriware.fr
Guest
Posts: n/a
 
      02-07-2007
On 7 fév, 11:43, (E-Mail Removed) wrote:
> On 6 Feb., 20:59, "Greg R. Broderick" <gregb
>
>
>
> (E-Mail Removed)> wrote:
> > (E-Mail Removed) wrote innews:(E-Mail Removed) groups.com:

>
> > > On 6 Feb., 14:31, Patricia Shanahan <(E-Mail Removed)> wrote:
> > >> (E-Mail Removed) wrote:
> > >> > Hi,

>
> > >> > I'm having a dataset which I use to multiply with another
> > >> > dataset. The number of multiplications is >5000 but constant.
> > >> > The time for computing varies (~0.1-0.2 s) for different
> > >> > datasets, although they are of the same size. What is the reason
> > >> > for this variation? Is it because of the zeros that are in the
> > >> > dataset such that multiplication with zero is faster than any
> > >> > other multiplication. So the more zeros the faster? Or is it
> > >> > maybe a memory problem?

>
> > >> There are all sorts of effects that could give a 0.1 second
> > >> variation in time unless you have things really well locked down.

>
> > >> Do repeated runs with the same dataset take the same amount of
> > >> time? In particular, try alternating runs with a "fast" and a
> > >> "slow" data set.

>
> > >> Patricia

>
> > > Well the problem is that I have only the results of the different
> > > datasets but I'm not able to test these anymore.
> > > BTW the total amount of processing time is approx 3.5 sec.

>
> > If you're trying to significantly speed up that 3.5 seconds, then I'd
> > suggest that attempting to optimize an operation that will, at best,
> > result in a 0.2 second improvement is a less-than-optimal use of your
> > time -- there are undoubtedly other optimizations that could result in
> > greater speed improvement.

>
> > Cheers
> > GRB

>
> Actually I don't want to speed it up. I just want to know why these
> variations exist although the operations are always the same.
>
> Thanks,
> Peter


If you are on windows, the resolution of the timer is about of 10 ms ,
unless you use the new System.nanoTime(), which resolution is much
finer, perhaps it's a problem of resolution of timer (for 0.1 - 0.2
sec, it's probably not the cause).

If the program use a database connection to retrieve the dataset,
perhaps the network or the database is busy during your test

The system is perhaps running another processes which use the CPU in
the same time

And if your program is multithreaded, other threads perhaps use the
CPU

So, there is multiple possible cause to explain your problem, we can't
tell much better without description of the system

(Sorry for my english, it's not my mnative language)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiplication of big numbers always says zero eli m C++ 10 03-18-2013 04:36 AM
Source of term "multiplication" in matrix multiplication William Hughes C Programming 13 03-15-2010 02:04 PM
Can you set a class instance's attributes to zero by setting the instance to zero? Gerard Flanagan Python 3 11-19-2005 06:58 PM
Doubles and zero/negative zero Christopher Benson-Manica C Programming 4 07-01-2004 05:44 PM
memset all bits to zero will let float/double to zero? Zhiqiang Ye C Programming 53 06-28-2004 01:23 PM



Advertisments