1

I've used Cygwin's pdflatex for the better part of a decade now. Being a non-administrator, I was locked down to a 2015 installation for several years. At around 2019, I was given the opportunity to update Cygwin, and I think it was around that time that I saw a marked slow down in pdflatex's processing of LaTeX documents, even small ones (my document sizes haven't changed much through the years). Since I work with multiple laptops, I estimate that this started occuring for me circa summer 2019, plus/minus perhaps 4 months. It is possible that the actual slowdown in Cygwin's pdflatex started well before then, with me being stuck in an 2015 installation and blissfully unaware.

I've done the online web search. I see complaints dating well before 2019 of Cygwin and various LaTeX processing software being slow, but no mention of a marked slowdown occuring between 2015 and 2019.

Since I am very much at the user level rather than admin level, I rely alot on the configuration of Cygwin apps as-installed. But I sometimes poke deeper, especially when repeatedly experiencing the agonizing slowness of compilation. What might cause this slowdown, and what measures can I take to mitigate this?

I'm seriously considering switching to MiKTeX, even though I would very much dislike leaving the non-GUI environment of Bash and Vim.

TROUBLESHOOTING

  • A minimal example file accompanied by the organizational texmf subtree compiled slowly too, i.e, with no references or acronyms. The console output scrolled very slowly compared to the 2015 installation.

  • In the console output, I sometimes see a single line of what seems like page numbers adorned with square brackets print out slowly. My naive impression from this is that this slowness is due to processing other than file searching.

  • I compared timed execution with MiKTeX and found it even slower than Cygwin's pdflatex (as predicted by Steven B. Segletes & Ulrike Fischer).

    • Erased auxiliary files and ran Bash script mkpdf.bash containing the usual pdflatex, bibtex, pdflatex x2

    • Timed the execution from Cygwin's Bash with time ./mkpdf.bash: 1m56s

    • Two tries of incremental runs of pdflatex using Cygwin's Bash: 38s, 37s
      export TEXMFHOME=texmf
      time pdflatex MainDocument.tex

    • MiKTeX with no "aux" files (pdfLaTeX+MakeIndex+BibTex): 2m18s

    • Choose incremental pdfLaTeX beside MiKTeX "play" button: 43s

  • 1
    I think MikTeX's pdflatex slowed down too. I am presuming it was some change in the engine that brought this about. However, I only notice it for a custom documentclass that loads a lot of packages. – Steven B. Segletes Mar 09 '21 at 15:51
  • 1
    I have cygwin texlive 2016 to 2021 pretest (deleted older ones tro make room so have not got 2015 anymore) and haben't seen any particular slow down. Make sure you are using the ls-R files and not searching the file system every time? – David Carlisle Mar 09 '21 at 15:51
  • 1
    I use cygwin as it's convenient but probably the native windows texlive woudl be quicker as the cygwin file system layer does have some cost (but mostly if iterating over housands of files, not noticable just working on one document loading a few packages) – David Carlisle Mar 09 '21 at 15:53
  • @David Carlisle: I googled TeXLive & am lost. I found that LaTeX is to TeX what pdflatex is to pdfTeX. The TeX Live pages I found say that it is a distribution of TeX, and I assume PdfTex as well. Does Cygwin's pdflatex use Tex Live? I also googled ls-R; it creates ~/texmf/ls-R, which I don't have. I have a my own texmf tree in the working folder of my document; it contains no ls-R. I Googled ls-R, but I think it requires much deeper expertise than I have. You mentioned using a Windows Tex Live, but if give up on Cygwin, I'll try MiKTeX 1st, since I've used it before. – user2153235 Mar 09 '21 at 16:23
  • 1
    Since I have not measured the slowdown, I could not say exactly, but saying it slowed down by a factor of 2x-plus would be in the realm of possibility. It is particularly noticeable when multiple passes are needed, as when changes in the toc or bibliography occur. – Steven B. Segletes Mar 09 '21 at 16:34
  • @Steven B. Segletes: A 2x slowdown means it's plausible that what I see is due (at least in part) to the engine slowdown that you speculate. I do use a documentclass designed by other LaTeX experts, but I did so for years before 2015. – user2153235 Mar 09 '21 at 16:43
  • The packages I include grow slowly through the years (always including the acro package), so it doesn't explain the several-fold slowdown in upgrading Cygwin. I can't recall exactly, but there was likely a short period when I had both old and new Cygwin installations, and noticed the speed difference for the same document. As for which passes are slowest, I do the typical pdflatex, bibtex, and pdflatex(x2). I haven't noticed a difference in slowness between them but will keep an eye out. I do have ToC & list of references. – user2153235 Mar 09 '21 at 16:43
  • 1
    miktex is compared to texlive my experience slower, so imho not the best option when speed is important. – Ulrike Fischer Mar 09 '21 at 17:11
  • 1
    texlive is a cross platform distribution, it has binaries for linux, mac, windows, cygwin or lots of other formats. So on windows you can use the windows binaries or the cygwin ones in cygwin or the linux ones in wsl. in cygwin as in linux you can use the version that comes with cygwin (installed via its setup) or (as I do) get the version from tug. I would say that any observable slowdown is due to misconfigured file searching rather than a chaneg in the actual program, btut it all depends... – David Carlisle Mar 09 '21 at 17:28
  • @David Carlisle: Thanks. I didn't know the relationship between pdflatex and Tex Live. After rummaging, I am 95% sure that Cygwin relies on Tex Live, and pdflatex is part of that or relies on that. If the slowdown is due to misconfigured file search, it would have to be misconfigured out-of-the-box; that's how I use pdflatex. Unless my document-specific texmf tree is responsible, and that tree is from my organization's wizards. I suspect that the texmf tree is not responsible, however, because all the organization uses copies of it, and I've heard no complaints (they use MiKTeX). – user2153235 Mar 09 '21 at 18:30
  • @Ulrike Fischer: Thanks for sharing your experience with MiKTeK being slower than TeX Live. I'm suspecting David Carlisle's suggestion that file search is misconfigured rather than TeX Live itself. I am of the few who prefer command line and Cygwin; the rest of the organization uses copies of the same texmf tree, but with MiKTeK. No one has complained. Raw speed under normal operation isn't my concern, but rather, black-box speed, including misconfiguration. Even if MiKTeK is normally slower, I will go for it if it avoids this very pronounced slowdown I'm experiencing with Cygwin. – user2153235 Mar 09 '21 at 19:07
  • the cygwin supplied tex is an (older) release of texlive yes. If your document specific texmf tree is large and in front of the standard tex input tree then it will impact file loading times proportional to the size of the texmf tree. as \documentclass{article} will have to search the filesystem to check there is no article.cls in your local texmf before using the quick hashed file lookup to access the standard copy. – David Carlisle Mar 09 '21 at 19:43
  • @David Carlisle: Thanks! My document-specific texmf contains only 34 files, and the custom-named document class is found therein, so it probably isn't the source of the slowdown. I'm starting to wonder if file configuration is the problem. – user2153235 Mar 09 '21 at 20:20
  • In the course of the above, I Googled the order in which folders are searched for a document class and found this thread, which told me that ls-R is located in texmf-dist. I found it at /usr/share/texmf-dist/ls-R. It doesn't shed light on the slowdown, but it's nice to find it after failing to do so. – user2153235 Mar 09 '21 at 20:22

1 Answers1

0

Someone in my organization reported a slowdown of the acro package at around the time I first saw it. I couldn't use the suggested [version=2] option because it causes both exclude and exclude-class options to go unrecognized. My solution was to disable acro package except for document finalization.

Here is the code to conditionally enable/disable the acro package. A single run of pdflatex now takes 13.5 seconds, which is a 3x speedup. Thanks for everyone's help.

% Acronyms
\newif\ifacro
\acrofalse % Replace with \acrotrue to enable acro package
\ifacro
   \usepackage[display-foreign=false]{acro}
      % https://tex.stackexchange.com/questions/499134/calling-acro-first-use-when-plural-is-producing-an-s-in-the-short-definition-t
   \input{acronyms}
\else
   \usepackage{suffix}
   \newcommand{\ac}[1]{\uppercase{#1}}
   \newcommand{\Ac}[1]{\uppercase{#1}}
   \newcommand{\acf}[1]{\uppercase{#1}}
   \newcommand{\Acf}[1]{\uppercase{#1}}
   \newcommand{\acs}[1]{\uppercase{#1}}
   \newcommand{\Acs}[1]{\uppercase{#1}}
   \newcommand{\acl}[1]{\uppercase{#1}}
   \newcommand{\Acl}[1]{\uppercase{#1}}
   \newcommand{\acp}[1]{\uppercase{#1}s}
   \newcommand{\Acp}[1]{\uppercase{#1}s}
   \newcommand{\acsp}[1]{\uppercase{#1}s}
   \newcommand{\Acsp}[1]{\uppercase{#1}s}
   \newcommand{\acfp}[1]{\uppercase{#1}s}
   \newcommand{\Acfp}[1]{\uppercase{#1}s}
   \newcommand{\aclp}[1]{\uppercase{#1}s}
   \newcommand{\Aclp}[1]{\uppercase{#1}s}
   \newcommand{\acresetall}{}
   \newcommand{\acuse}{}
   \WithSuffix\newcommand\ac*[1]{\uppercase{#1}}
   \WithSuffix\newcommand\Ac*[1]{\uppercase{#1}}
   \WithSuffix\newcommand\acf*[1]{\uppercase{#1}}
   \WithSuffix\newcommand\Acf*[1]{\uppercase{#1}}
   \WithSuffix\newcommand\acs*[1]{\uppercase{#1}}
   \WithSuffix\newcommand\Acs*[1]{\uppercase{#1}}
   \WithSuffix\newcommand\acl*[1]{\uppercase{#1}}
   \WithSuffix\newcommand\Acl*[1]{\uppercase{#1}}
   \WithSuffix\newcommand\acp*[1]{\uppercase{#1}s}
   \WithSuffix\newcommand\Acp*[1]{\uppercase{#1}s}
   \WithSuffix\newcommand\acsp*[1]{\uppercase{#1}s}
   \WithSuffix\newcommand\Acsp*[1]{\uppercase{#1}s}
   \WithSuffix\newcommand\acfp*[1]{\uppercase{#1}s}
   \WithSuffix\newcommand\Acfp*[1]{\uppercase{#1}s}
   \WithSuffix\newcommand\aclp*[1]{\uppercase{#1}s}
   \WithSuffix\newcommand\Aclp*[1]{\uppercase{#1}s}
\fi

<...snip...>

\ifacro \cleardoublepage \printacronyms[% name = {List of abbreviations/acronyms/initialisms/symbols}, sort = false ] \fi