auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX] Avoiding multiple calls to kpsewhich


From: jfbu
Subject: [AUCTeX] Avoiding multiple calls to kpsewhich
Date: Thu, 30 Apr 2015 12:22:53 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

Hi,

although the situation is *much* improved with upcoming
TeXLive 2015, kpsewhich is quite slow for querying paths
on Mac OS X:

texlive 2014:

$ time kpsewhich article.cls
/usr/local/texlive/2014/texmf-dist/tex/latex/base/article.cls

real    0m0.568s
user    0m0.544s
sys     0m0.015s

texlive 2015:

$ time kpsewhich article.cls
/---/TL2015/texmf-dist/tex/latex/base/article.cls

real    0m0.099s
user    0m0.085s
sys     0m0.008s

The situation is the same when one only attempts
to get the installation repertories locations,
(TL2014:)

$ time kpsewhich --var-value TEXMFHOME
/Users/---/Library/texmf

real    0m0.516s
user    0m0.499s
sys     0m0.013s

(It appears that kpsewhich parses completely
various ls-R files even when used only as above
to query the TEXMFHOME repertory.)

During initial load, AUCTeX makes calls to kpsewhich.
(nine such calls with my set-up)

Would it be possible to get TeX-tree-expand
in tex.el to make a single kpsewhich call, and not one for
each passed 'var' of the list

(defun TeX-tree-expand (vars program &optional subdirs)
  "Return directories corresponding to the kpathsea variables VARS.
This is done calling `kpsewhich --expand-path' for each variable.

My question is whether it is possible to arrange TeX-tree-expand
to do rather a single kpsewhich call.

This should be possible as seen from that example:

kpsewhich --progname latex --expand-path 
'$SYSTEXMF:$TEXMFLOCAL:$TEXMFMAIN:$TEXMFDIST:$TEXMFHOME'

returns

/usr/local/texlive/2014/texmf-var:/usr/local/texlive/texmf-local-2014:/usr/local/texlive/2014/texmf-dist:/usr/local/texlive/texmf-local-2014:/usr/local/texlive/2014/texmf-dist:/usr/local/texlive/2014/texmf-dist:/Users/---/Library/texmf

(notice that SYSTEXMF by itself by default already expands to the
first three in the ouput as one finds
SYSTEXMF = $TEXMFSYSVAR;$TEXMFLOCAL;$TEXMFDIST in the default
texmf.cnf)

I am putting quotes as I am testing this from command line
and must avoid shell expansion of $

The kpsewhich manual is athttp://tug.org/texinfohtml/kpathsea.html :

5.5.3 Auxiliary tasks


[...]
‘--expand-path=string’ outputs the complete expansion of string, with
each element separated by the usual path separator on the current
system (‘;’ on Windows, ‘:’ otherwise).
[...]

I have no idea whether kpsewhich evolved on that point and
assuming the current functionality would break old systems.

Another issue is that during the loading of AUCTeX it appears that
locations TEXMFLOCAL, TEXMFMAIN, TEXMFDIST, TEXMFHOME are each queried
twice. Could this also be avoided ?

A single kpsewhich call rather than 9 would almost divide by 9 the loading
time of AUCTeX on Mac OS X systems (because it appears that most of
this loading time is taken up by the calls to kpsewhich)

Jean-François





reply via email to

[Prev in Thread] Current Thread [Next in Thread]