From maintainers-request at octave dot org Sun Jan 30 00:49:46 2005 Subject: Re: min function very slow? From: "Dmitri A. Sergatskov" To: Daniel J Sebald CC: maintainers at octave dot org Date: Sat, 29 Jan 2005 23:51:41 -0700 This is a multi-part message in MIME format. --------------020104090705070205080701 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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. > Dan > Dmitri. --------------020104090705070205080701 Content-Type: text/x-objcsrc; name="mmt.m" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mmt.m" function [looptime,maxtime,mintime]=mmt(N_loop) 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; endfunction --------------020104090705070205080701--