[tlbuild] TL installation on Cygwin is slow

Reinhard Kotucha reinhard.kotucha at web.de
Thu Nov 13 00:34:57 CET 2014


Hi Ken,
from previous messages on this list I conclude that you are
maintaining TL on Cygwin. 

I recently installed Cygwin and it took a lot of time to install the
TeX Live packages.  Though I installed zillions of other packages too,
the installer spent most of the time executing the TeX Live
postinstall scripts.  The reason is that there are way too many
invocations of mktexlsr, many of them are unnecessary.

Example:

texlive-collection-langgreek.sh
-------------------------------------------------------------------------
/usr/bin/mktexlsr
/usr/bin/updmap-sys --nohash --nomkmap --enable MixedMap=cbgreek-full.map
/usr/bin/updmap-sys --nohash --nomkmap --enable Map=gfsbaskerville.map
/usr/bin/updmap-sys --nohash --nomkmap --enable Map=gfsporson.map
/usr/bin/updmap-sys --nohash --nomkmap --enable MixedMap=iby.map
/usr/bin/updmap-sys --nohash --nomkmap --enable Map=kerkis.map
/usr/bin/updmap-sys --nohash --syncwithtrees
/usr/bin/updmap-sys --nohash
/usr/bin/mktexlsr
/usr/bin/fc-cache -f /usr/share/texmf-dist/fonts/opentype
/usr/bin/fc-cache -f /usr/share/texmf-dist/fonts/type1
-------------------------------------------------------------------------

The first invocation of mktexlsr is unavoidable (at a first glance)
because new files had been installed and updmap-sys has to find them.
However, both, mktexlsr and updmap-sys can be run later, see below.

As a first measure I suggest to simply replace

  /usr/bin/updmap-sys --nohash
  /usr/bin/mktexlsr

with

  /usr/bin/updmap-sys

This speeds up everything significantly.

Without the --nohash option updmap-sys appends an entry to
$TEXMFSYSVAR/ls-R for every file it has written.  No need to run
mktexlsr at all.  This is very efficient because there is no need to
scan the filesystem.

mktexlsr is a very expensive operation, especially if $TEXMFDIST is
involved, and should be avoided whenever possible.

Another expensive operation is updmap-sys --syncwithtrees.  It's less
expensive than mktexlsr because it only checks whether files mentioned
in updmap.cfg are present on the filesystem.  It's only needed if .map
files had been removed from the filesystem.  Maybe it's sufficient to
run updmap-sys --nohash --syncwithtrees only if updmap-sys fails.

  updmap-sys || (echo y|updmap-sys --nohash --syncwithtrees;updmap-sys) 

I'm not sure (I was at lunch while the installer was running) but it
seems that all the postinstall scripts are executed after all files
had been installed.  In this case it's possible to run the
time-consuming scripts only once.  The scripts should then contain
the --enable commands only:

texlive-collection-langgreek.sh
-------------------------------------------------------------------------
/usr/bin/updmap-sys --nohash --nomkmap --enable MixedMap=cbgreek-full.map
/usr/bin/updmap-sys --nohash --nomkmap --enable Map=gfsbaskerville.map
/usr/bin/updmap-sys --nohash --nomkmap --enable Map=gfsporson.map
/usr/bin/updmap-sys --nohash --nomkmap --enable MixedMap=iby.map
/usr/bin/updmap-sys --nohash --nomkmap --enable Map=kerkis.map
-------------------------------------------------------------------------

Please note that at this point it's not necessary to run mktexlsr
because only the value of --enable is added to updmap.cfg.  These
operations are very cheap and time consumption is negligible.

Then texlive.sh should look like this:

-------------------------------------------------------------------------
/usr/bin/mktexlsr
/usr/bin/fmtutil-sys --refresh
/usr/bin/updmap-sys --nohash --syncwithtrees
/usr/bin/updmap-sys
/usr/bin/fc-cache -f /usr/share/texmf-dist/fonts/opentype
/usr/bin/fc-cache -f /usr/share/texmf-dist/fonts/type1
/usr/bin/fc-cache -f /usr/share/texmf-dist/fonts/truetype
-------------------------------------------------------------------------

In this case all the expensive scripts become inexpensive because they
are run only once.  In order to take into account that some
collections don't contain any fonts you can suppress updmap and
fc-cache.  The postinstall scripts for collections containing fonts
should contain the line

  touch /var/run/process-texlive-fonts

And texlive.sh could look like this:

-------------------------------------------------------------------------
/usr/bin/mktexlsr
/usr/bin/fmtutil-sys --refresh
if [ -f /var/run/process-texlive-fonts ]; then
  /usr/bin/updmap-sys --nohash --syncwithtrees
  /usr/bin/updmap-sys
  /usr/bin/fc-cache -f /usr/share/texmf-dist/fonts/opentype
  /usr/bin/fc-cache -f /usr/share/texmf-dist/fonts/type1
  /usr/bin/fc-cache -f /usr/share/texmf-dist/fonts/truetype
fi
rm -f /var/run/process-texlive-fonts
-------------------------------------------------------------------------

After all, I think that some kind of optimization is very helpful.
Though Cygwin is a Unix environment, it runs under Windows and thus is
extremely slow.  I don't know what makes Windows so slow but I suppose
that the filesystem is the main culprit.  Maybe creating new processes
is expensive too.

Currently the installer runs mktexlsr at least once for every package
end even twice if a particular package contains fonts.  My impression
is that the current installer unnecessarily wastes more than one hour
in order to do unnecessary things at each full TL installation.  I'm
convinced that it's not difficult to improve it significantly without
great effort.

Regards,
  Reinhard

-- 
------------------------------------------------------------------
Reinhard Kotucha                            Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                    mailto:reinhard.kotucha at web.de
------------------------------------------------------------------


More information about the tlbuild mailing list