[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: min function very slow?

From: Dmitri A. Sergatskov
Subject: Re: min function very slow?
Date: Sat, 29 Jan 2005 23:51:41 -0700
User-agent: Mozilla Thunderbird 0.9 (X11/20041127)

Daniel J Sebald wrote:
Dmitri A. Sergatskov wrote:

Daniel J Sebald wrote:

Thank you... so do you think your increase for mintime is a blip in the OS? Yours is a factor of 4.5 difference, mine is a factor of 76.

I do not understand this at all. More over on my other computer (AthlonXP 1666 MHz)
the mintime is 2 seconds... The same OS etc...

So I'm not dreaming.  :-)

I put a script in my path to redefine min(x) as -max(-x). That gets me down to the numbers your quoting. I'll see if I can run a profiler on this. I don't think it is in dNDArray.cc where it is spending its time.

I rewrote your script as a function (attached). Here is some numbers:

octave:1> [loopt,mint,maxt]=mmt(10000)
loopt = 0.040803
mint = 0.19301
maxt = 0.22110
octave:2> [loopt,mint,maxt]=mmt(10000)
loopt = 0.031585
mint = 0.18326
maxt = 23.859
octave:3> [loopt,mint,maxt]=mmt(10000)
loopt = 0.039405
mint = 0.18089
maxt = 22.695

On SMP computer (octave compiled with -lpthread, otherwise the same flags):

octave:1> [loopt,mint,maxt]=mmt(10000)
loopt = 0.033668
mint = 0.15524
maxt = 0.18152
octave:2> [loopt,mint,maxt]=mmt(10000)
loopt = 0.026402
mint = 0.14753
maxt = 2.6565

As you can see the first time it runs it gets reasonable numbers, after that it 
goes nuts.


function [looptime,maxtime,mintime]=mmt(N_loop)
for i=1:N_loop
  j = i;
looptime = toc();
for i=1:N_loop
  j = max(i);
maxtime = toc() - looptime;
for i=1:N_loop
  j = min(i);
mintime = toc() - maxtime;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]