[tex-k] Speed of kpsewhich when querying the repertories of the TeX installation
Reinhard Kotucha
reinhard.kotucha at googlemail.com
Mon May 4 09:41:10 CEST 2015
On 2015-05-01 at 16:10:17 +0900, Norbert Preining wrote:
> > There must be at least one initial hard-coded path no? I can't
> > relocate kpsewhich anywhere on my system or can I ?
>
> You can relocate, check the installation of TeX Live, you can
> choose whereever you want.
>
> kpsewhich searches for the initial texmf.cnf in a (long) list
> of defined locations, that allows for relocation, plus some
> fixed locations.
>
> > Are you sure kpsewhich does not do, apart from evaluating the
> > contents of the texmf.cnf files, do some un-needed parsing of ls-R
>
> Of course it does ls-R parsing, but it is not unneeded. Because
> the ls-R is used to find the other files, including other texmf.cnf
> files (as far as I know).
Kpathsea needs the ls-R files in order to find all the *other* files
but it has to read the texmf.cnf file[s] *first* in order to know
where the ls-R files are i.e., which directory trees are defined in
the config file[s].
kpsewhich --debug=-1 --expand-path=\$TEXMFHOME 2>&1 | grep 'Search path'
kdebug:Search path for cnf files (from compile-time paths.h)
kdebug:Search path for ls-R files (from texmf.cnf)
It seems that kpsewhich first evaluates 2015/texmf.cnf and then looks
for web2c directories in a list of pre-definened paths.
Finally it loads ls-R files but it doesn't search for any other web2c
directories in additional local trees. Hence I think that the ls-R
files are not needed for variable expansion and evaluation may be
omitted for some particular kpsewhich options.
This is at least what I deduce from the output of
kpsewhich --debug=-1 --expand-path
but I fear that only Karl knows the whole story.
After all, I'm convinced that reading ls-R files is the most expensive
part here because the file system is involved. If only variables have
to be expanded everything should be doable within a few milliseconds,
including the creation of the kpsewhich process itself.
Regards,
Reinhard
--
------------------------------------------------------------------
Reinhard Kotucha Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover mailto:reinhard.kotucha at web.de
------------------------------------------------------------------
More information about the tex-k
mailing list