[tex-k] Speed of kpsewhich when querying the repertories of the TeX installation

jfbu jfbu at free.fr
Thu Apr 30 23:51:39 CEST 2015

Le 30 avr. 2015 à 23:42, Karl Berry <karl at freefriends.org> a écrit :

>    I may write a Makefile which will act after querying
>    the repertories locations. But one tenth of a second
>    for each kpsewhich call is a lot.
> Save the result instead of making the same call thousands of times.  I
> don't agree that 100 ms is such a horrible time to do all those
> filesystem operations.  In fact, it seems rather quick to me.
>    Could it be imagined to have some kpsewhichdir utility
> 1) I fail to see how making a utility restricted to a single variable
> could speed anything up.  

I probably did not express myself precisely. I am not targeting
a single variable; I am targeting the variables describing the main
repertories of the TeXLive installation

> Surely what takes the time is looking for the
> config files in all the possible directories, and (more so) reading the
> ls-R file.  If you run kpsewhich --debug=-1 --expand-path=\$TEXMFHOME,
> you will see what it's doing.

I am sure kpsewhich does a lot, but does one need to do such a lot
such to tell where is TEXMFLOCAL and TEXMFHOME and TEXMFDIST ?

one might need to do things to find packagefoo.sty via the 
parsing of the ls-R files or system calls to ls, but why would these things
be needed for the main installation repertories ???

Perhaps many distributions set up environment variables thus
the speed penalty is not obvious to these users.

> 2) Regardless, the idea of a utility dedicated to a single variable
> sounds wrong in principle to me and I don't think it should be done.
>    the environment variable $TEXMFHOME 
> So far as I can see, if the envvar is set, its value is already (has
> always been) returned "instantly".  The lookups are only done if they
> need to be.
> karl

I have none such environment variable and do not see why I should
set some


More information about the tex-k mailing list