auctex
[Top][All Lists]
Advanced

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

Re: [AUCTeX] Avoiding multiple calls to kpsewhich


From: jfbu
Subject: Re: [AUCTeX] Avoiding multiple calls to kpsewhich
Date: Thu, 30 Apr 2015 15:17:11 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:9.0) Gecko/20111222 Thunderbird/9.0

le 30/04/2015 12:22 selon jfbu:
> 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
> 

On a Linux box with AUCTeX 11.86

Emacs  : GNU Emacs 23.2.1 (i386-redhat-linux-gnu, GTK+ Version 2.20.1)
 of 2010-06-03 on x86-07.phx2.fedoraproject.org
Package: 11.86 
AUCTeX-date "2010-02-21"

the behavior is different. First, there is a site-start.el which, it seems, 
loads auctex on Emacs launch.

C-h v TeX-macro-global

returns a value even before C-xC-f any foo.tex file

Furthermore during this loading only 2 calls to kpsewhich are made:

jeu. avril 30 15:04:38 CEST 2015 + kpsewhich --progname latex --expand-braces 
$SYSTEXMF
jeu. avril 30 15:04:38 CEST 2015 + kpsewhich --progname latex --expand-braces 
$TEXMFHOME

this is to be compared to the 9 calls with AUCTeX 11.88 which I reported
earlier

Thu Apr 30 10:00:10 CEST 2015 + kpsewhich --progname latex --expand-path 
$SYSTEXMF
Thu Apr 30 10:00:11 CEST 2015 + kpsewhich --progname latex --expand-path 
$TEXMFLOCAL
Thu Apr 30 10:00:11 CEST 2015 + kpsewhich --progname latex --expand-path 
$TEXMFMAIN
Thu Apr 30 10:00:12 CEST 2015 + kpsewhich --progname latex --expand-path 
$TEXMFDIST
Thu Apr 30 10:00:12 CEST 2015 + kpsewhich --progname latex --expand-path 
$TEXMFHOME
Thu Apr 30 10:00:13 CEST 2015 + kpsewhich --progname latex --expand-path 
$TEXMFHOME
Thu Apr 30 10:00:13 CEST 2015 + kpsewhich --progname latex --expand-path 
$TEXMFMAIN
Thu Apr 30 10:00:14 CEST 2015 + kpsewhich --progname latex --expand-path 
$TEXMFLOCAL
Thu Apr 30 10:00:14 CEST 2015 + kpsewhich --progname latex --expand-path 
$TEXMFDIST


The speed of kpsewhich (from TeXLive 2015) on this Linux box is comparable
to the one on my Mac OS X laptop (with TeXLive 2015)

Best

Jean-François








reply via email to

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