[tex-live] Patch for "texdoc -s" to use the ls-R database
Frank Küster
frank at kuesterei.ch
Wed May 30 19:35:27 CEST 2007
"George N. White III" <gnwiii at gmail.com> wrote:
> There are still performance problems. Try to find the latin modern
> docs:
>
> "texdoc -s lmodern" doesn't help, but "texdoc -s lm" takes much too
> long because the last kpathsea search is run for every lm*.tfm file!
>
> What is needed is a way to select only the shortest prefixes from
> "kpsewhich --expand-path='$TEXDOCS'" so that find isn't searching
> the same places over and over:
Here's a new suggestion. It uses a new switch for the new behavior (-S)
and does the following to reduce the time needed:
I define a NODOC_PATTERN which contains the most abundant extensions of
probably-not-documentation files:
NODOC_PATTERN="\.tfm$|\.afm$|\.enc$|\.pfb$|\.pfa$|\.pfm$|\.vf|\.fd$|\.ttf$|\.htf$|\.mf$|\.otf$|\.[[:digit:]]*pk$"
there's still a for loop over all files found in ls-R, but it kpsewhich
is only called if this pattern does not match. I think the exact
pattern should finally be made customizable with an option. I also
check whether a filename appears more than once in the grepped list, and
call kpsewhere instead of kpsewhich in this case.
With the old implementation (texdoc -s lm), I get
real 1m14.285s
user 0m0.364s
sys 0m1.336s
Using the new one immediately afterwards, I get
real 0m18.237s
user 0m13.577s
sys 0m4.056s
(after a reboot, I even got only
real 0m16.457s
user 0m10.781s
sys 0m3.312s
)
This is still not lightning fast, but it's a considerable
improvement. Of course, it would be best to grep only through the doc
parts of ls-R, but I don't have any idea how to get that with shell and
simple tools. Or I reimplement texdoc in Perl - maybe that's even an
improvement for the windows people?
Regards, Frank
--
Dr. Frank Küster
Single Molecule Spectroscopy, Protein Folding @ Inst. f. Biochemie, Univ. Zürich
Debian Developer (teTeX/TeXLive)
More information about the tex-live
mailing list