[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
min function very slow?
From: |
Daniel J Sebald |
Subject: |
min function very slow? |
Date: |
Sat, 29 Jan 2005 19:36:13 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020 |
My eyes are deceiving me. I came across a slow loop and to my surprise
traced it to the min function. But I'm wondering how this can be
because I looked through the source code and the min/max commands inside
minmax.cc and dNDArray.cc look identical except obviously for the change
in sign when testing order. I have a fairly recent version of 2.1.64.
I put together a little test script. Someone please try the attached
script. My result is
octave:1> minmaxtime
looptime = 0.044205
maxtime = 0.081752
mintime = 7.5832
Thank you,
Dan
N_loop = 1000;
tic()
for i=1:N_loop
j = i;
end
looptime = toc()
for i=1:N_loop
j = max(i);
end
maxtime = toc() - looptime
for i=1:N_loop
j = min(i);
end
mintime = toc() - maxtime
- min function very slow?,
Daniel J Sebald <=
- Re: min function very slow?, Dmitri A. Sergatskov, 2005/01/29
- Re: min function very slow?, John W. Eaton, 2005/01/30
- Re: min function very slow?, Dmitri A. Sergatskov, 2005/01/30
- Re: min function very slow?, John W. Eaton, 2005/01/30
- Re: min function very slow?, Daniel J Sebald, 2005/01/30