[Top][All Lists]

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

Re: min function very slow?

From: Daniel J Sebald
Subject: Re: min function very slow?
Date: Sun, 30 Jan 2005 01:46:03 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020

Daniel J Sebald wrote:

John W. Eaton wrote:

If you have min and max in .oct files, then they are really defined in
the same file (minmax.oct) and the min.oct and max.oct files are just
additional links in the filesystem.  It seems that the second one
loaded is much slower.  I think this must be some accidental overhead
in checking whether the symbol needs to be reloaded.

But how would this account for Dmitri's example in a script file where upon first run it's fine and thereafter is slow?

 The problem goes
away for me if I define min and max in separate files (i.e., create
min.cc and max.cc, each with only one DEFUN_DLD macro) or if I set
ignore_function_time_stamp = "all" (I'm not sure why setting it to
"system" fails, even when the min/max functions are installed in a
"system" directory).

But breaking it into separate files could simply be shuffling around code as well. I.e., the problem moves somewhere else.

On second thought, your hypothesis seems correct. rand() and randn() are similar to max/min, being in the same file. I rewrote the function with rand/randn and got similar behavior:

octave:1> [loopt, randt, randnt] = rrt(10000)
loopt = 0.10696
randt = 0.36079
randnt = 0.35501
octave:2> [loopt, randt, randnt] = rrt(10000)
loopt = 0.10461
randt = 0.34843
randnt = 7.3243

reply via email to

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