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

jfbu jfbu at free.fr
Wed Oct 8 08:37:22 CEST 2014


> 
> 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
> | 


I get
$ time kpsewhich -var-value=SELFAUTOLOC
/usr/local/texlive/2014/bin/x86_64-darwin

real	0m0.005s
user	0m0.001s
sys	0m0.002s

although on first invocation it was
real	0m0.019s
user	0m0.001s
sys	0m0.003s

(the 0.005s is on the third invocation)

time kpsewhich -var-value=TEXMFLOCAL
always returns about 0.5s, independently of
the number of invocations

> 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 have loads to learn before becoming a power user... I am sure mac os x
provides all means to analyze things (it has an Activity Monitor which 
provides all sorts of diagnostics, and surely can be triggered from command
line too) inclusive of the standard Unix tools on which it is built. I am just
ignorant, although I do have also XCode installed on my machine.

For info, I ran again 
time kpsewhich -var-value=TEXMFLOCAL 
with all
GUI applications off and the result is the same.

> 
>> 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.  

I see, the timing being only a tiny bit smaller on my machine
 for -var-value TEXMFLOCAL 
compared to locating hyperref.sty
it does suggest that most of what is done in this execution of kpsewhich
for locating a file is also done when running kpsewhich with 
only the option -var-value 


> 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
> 
> -- 

thanks,

Jean-Francois




More information about the tex-k mailing list