[tex-k] speed of kpsewhich to get value of TEXMFLOCAL

Reinhard Kotucha reinhard.kotucha at web.de
Wed Oct 8 03:35:35 CEST 2014


On 2014-10-07 at 16:02:57 -0600, Karl Berry wrote:

 > 2) The "bottleneck" is not generic to any installation.  Running
 > kpsewhich -var-value=TEXMFLOCAL returns instantly on my machine,

What is "instantly" in seconds?  See below.

 > and, I would assume, just about everyone else's or this exact
 > report would be flooding the list.  After all, this invocation is
 > just reading a couple relatively small text files.

It's reading all the ls-R files.  Checked with strace(1).
I suppose that kpathsea creates the hash tables too which takes
additional time.

But why are the ls-R files needed in order to determine the value of
TEXMFLOCAL?

 | $ time kpsewhich -var-value=SELFAUTOLOC
 | /usr/local/texlive/2014/bin/x86_64-linux
 | 
 | real	0m0.003s
 | user	0m0.000s
 | sys	0m0.002s
 | 
 | $ time kpsewhich -var-value=TEXMFLOCAL
 | /usr/local/texlive/texmf-local
 | 
 | real	0m0.189s
 | user	0m0.175s
 | sys	0m0.011s

Why are SELFAUTOLOC and TEXMFLOCAL treated differently?


BTW, without the filesystem cache I get

 | # echo 1 > /proc/sys/vm/drop_caches
 | 
 | $ time kpsewhich -var-value=TEXMFLOCAL
 | /usr/local/texlive/texmf-local
 | 
 | real	0m0.555s
 | user	0m0.160s
 | sys	0m0.021s

Jean-Francois, this value is close to that one you reported.  It's quite
useful to run a system monitor when doing benchmarks.  The first thing
you'll learn is that benchmarks are more or less worthless when a
resource greedy web browser is running.

 > I realize that some other operations of kpsewhich have that overhead:
 > 
 > $ time kpsewhich hyperref.sty

In this case there is no overhead.  If you use kpsewhich in order to
locate files then all the ls-R files have to be read.  This takes more
time than expanding a variable, of course.  The question is why the
ls-R files are read in order to determine the value of TEXMLOCAL while
it's not necessary in order to expand SELFAUTOLOC.

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