From bug-request at octave dot org Fri Apr 14 12:11:44 2006 Subject: Re: finding everything fast From: "John W. Eaton" To: Tom Holroyd Cc: bug at octave dot org Date: Fri, 14 Apr 2006 13:11:21 -0400 On 8-Apr-2006, Tom Holroyd wrote: | On Fri, 7 Apr 2006, Tom Holroyd (NIH/NIMH) [E] wrote: | | > searching the entire LOADPATH, every time. I think the code in kpse.cc that is supposed to handle caching of file names in the path is not being used properly. | I'm not sure what the intent is here, or where the code is, but I | guess there is always the possibility that sometimes, you will | want to search the entire path for a function, even if you | already know where it is. Yes, I think Octave needs to do this to properly implement the autoload-if-there-is-a-newer-version-somewhere-on-the-path semantics of Matlab. So it does need to search the path again to see if a newer function has appeared. But I agree that something is currently broken as we should be able to cache the contents of directories and only check the disk if it appears that a directory in the path has changed. In any case, looking at the disk should only happen once per prompt, not on every call to a function | It would probably be a good idea | though, to have a feature that allowed such searching to be | turned off, for "production" installations where everything is | already installed right and you know that nothing is going to | change during a run. Then it could just cache the locations of | all functions at startup time and be done with it. I don't think this should be necessary if the check only happens once per prompt and if caching of filenames on the path is working correctly. The path searching code used to depend on ls-R files (like those used for TeX systems that use the kpathsearch library) but that turned out to have its own problems. I think the best thing to do is modify the path searching code to construct an internal version of the ls-R database incrementally as needed. I don't think this is currently happening. jwe ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------