cgnieder / acro

acronyms for LaTeX
LaTeX Project Public License v1.3c
41 stars 9 forks source link

latex compilation very slow when using long list of acro definitions #205

Open EdTrippy opened 3 years ago

EdTrippy commented 3 years ago

I use a master acronym list which hold all my acro definitions, I just keep adding to it as I need new ones. I had been doing this for years and didn't see any real change in compilation time as the list grew longer. However, since the recent updates in 2020 it is very slow. As a test I compiled the same document using the long master list of acronyms, 1min 27s, versus a short list of just the acros used in that doc, 14s.

Was there a significant change to how the acro functions that would cause this slowness and could it be fixed?

cgnieder commented 3 years ago

When I only read the title of this issue I was worried about compilation times about 15 min and such (people do have that https://tex.stackexchange.com/q/579811/).

Was there a significant change to how the acro functions that would cause this slowness

See this announcement https://ctan.org/ctan-ann/id/mailman.139.1588268227.3866.ctan-ann@ctan.org

and could it be fixed?

I'd rather not say “fixed” in this case: there is nothing “broken”. I have a good idea what causes this behavior but not a very good idea how to improve performance.

How many acronyms are we talking about?

EdTrippy commented 3 years ago

On the full document compilation time is upwards of 5min, the example I gave of 1.5min was only for a portion to show the difference. These are compiled on a fairly new high end work station. When using the full acro list its on the order of say 200+ acronyms. In the reduced case it was about 20. I've been using acro for a couple years now it compilation time was never an issue until these last few updates (not sure exactly when as I'm not always using the latest). PS, this package is otherwise fantastic and hugely helpful. My reports are crammed with acronyms and this really helps me keep track.

I noticed that when compiling it creates a new .acr file which looks like it goes and counts usages of each defined acronym in the document. Is this what's slowing it down? Because its searching for a bunch of acronyms that are defined but not used?

cgnieder commented 3 years ago

I noticed that when compiling it creates a new .acr file which looks like it goes and counts usages of each defined acronym in the document. Is this what's slowing it down? Because its searching for a bunch of acronyms that are defined but not used?

No. The problem is mostly the updating of the acronym properties at begin and and document as far as I found out through performance tests.

Depending on your needs you might just go back to v2.x by using \usepackage[version=2]{acro}. This uses the last version before the change. The manual for that version is available here: https://github.com/cgnieder/acro/tree/e437e8e20ab0bc5efd8bc66cd08decf48414631e

EdTrippy commented 3 years ago

Depending on your needs you might just go back to v2.x by using \usepackage[version=2]{acro}. This uses the last version before the change. The manual for that version is available here: https://github.com/cgnieder/acro/tree/e437e8e20ab0bc5efd8bc66cd08decf48414631e

Thanks, I tried v2 and it made huge difference. Compiling in seconds now.

JeT76-ESCP commented 2 years ago

Hello Clemens,

I hope you're fine.

I've just updated to acro3.8 on MikTeX and was interested in your tabularray integration. I use very long myacronym.tex files (~600).

It seems (still investigating) that the compilation time is endless now. I am suprised cause I compiled my file yesterday night before update and it was ok.

From what I see, it's at the moment myacronym.tex is being loaded.

I noticed that the compilation is struggling during the sequence below when each acronym is added.

\c@g@acro@l3m@int=\count822
\c@g@acro@l6m@int=\count823
\c@g@acro@ladder@int=\count824

I reverted to previous 3.7 and it works fine.

kind regards, Julien-Elie

manffredd commented 2 years ago

Could anyone advise on how to revert to v2 of the acro package? I went from compiling my documents in 2 minutes to a solid 18 minutes overnight. I do have +400 acronyms in a .tex "database", but it wasn't ever a real problem.

I tried specifying \usepackage{acro}[=v2] in my .sty file where I load all my packages, but I get the following error:

! LaTeX3 Error: The key 'acro/patch/floats' is unknown and is being ignored.

and

! LaTeX3 Error: The key 'acro/declare-acronym/tag' is unknown and is being ignored in every \DeclareAcronym instance.

Alternatively, would anyone suggest switching to a different package with the same purpose? Although going through +2000 lines of acronym definitions to a different syntax would be the best idea...

My current project structure is as follows:

\input{MyStyleFile.sty}
\input{MyCustomCommands.tex}
\input{AcronymsDatabase.tex}

\begin{document}

\tableofcontents\newpage                    %table of contents
\listoftables\newpage                       %list of tables
\listoffigures\newpage                      %list of figures
\def\listofacro{List of Acronyms}                   %define a variable for the following two lines
\addcontentsline{toc}{section}{\listofacro}         %add list of acronyms to the table of contents
\printacronyms[template=description, name=\listofacro]  %list of acronyms
\newpage

\input{MyFirstChapter.tex}
\input{MySecondChapter.tex}
\input{MyConclusion.tex}

\end{document}

Note that 90% of the compilation time is spent on the \input{AcronymsDatabase.tex} line of the code (I've timed it :) ).

Please advice, thank everyone.

Ps.

I'm running TexMaker on Linux with the TeXLive distribution version 2022.63035-1

cgnieder commented 2 years ago

You can't use the option patch/floats with v2, it's a v3 option. If you need the manual for v2, have a look here https://github.com/cgnieder/acro/releases/tag/v2.10

manffredd commented 2 years ago

Thank you for the input, I was able to fix the issue by reverting to version 2. However, I must make strong emphasis that the latest versions 3 of the acro package is indeed downgrading the performance of my own and my colleagues projects.

We use LaTeX and a combination of packages at an enterprise level for technical documentation and we have been forced to re-structure a number of templates and on-going documentation to revert back to faster compilation.

I raised this concern not out of discontent with the acro project, but as a general note on the negative impact the updates played on my part. Hopefully, my feedback can help in any way the future work.

Thank you again for your time.

Chris-B73 commented 1 year ago

Glad I found this topic since I have the same problem with v3.8 (thought it was unavoidable) but can not use v2 because of an error I can not track down:

`/usr/local/texlive/2023/texmf-dist/tex/latex/acro/acro.sty:210: Use of \??? doesn't match its definition.

\??? ! LaTeX Error: Blank key name in key-value input on line 210` Is there anything else I can do to speed up compilation time?
NotNormallyAGitUser commented 11 months ago

I reverted to previous 3.7 and it works fine.

kind regards, Julien-Elie

When I moved from 3.8 to 3.7, my execution of "pdflatex" dropped from 1m10s to 0m10s. Since I run "pdflatex" three times in succession, my document compile times dropped from 3.5 minutes to 0.5 minutes. I recompile a lot to check my acronyms and math.

I fetched 3.7 from GitHub, under "Assets". I placed the files "acro[2].sty" into subfolder texmf/tex/latex/base. It is rooted in the working folder for the main LaTeX document, from where I issue "pdflatex".

ytzemih commented 8 months ago

I can confirm this issue when switching from 3.7- to 3.8 (because of a renewal of my Linux/TexLive installation). Compilation really takes significantly longer now, minutes instead of seconds. I'm using enough of a lightweight configuration that allowed me to switch back to v2, where everything is fine again with the same number of acronyms.