JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.75k stars 5.49k forks source link

Building Julia docs in PDF format is too slow #48896

Open inkydragon opened 1 year ago

inkydragon commented 1 year ago

build step

deps

make docs
make -C doc pdf  # Takes a looooong time
logs ``` $ make -C doc pdf make: Enter the directory “/cygdrive/v/julia/doc” /cygdrive/v/julia/deps/tools/jlchecksum "/cygdrive/v/julia/deps/srccache/UnicodeData-13.0.0.txt" cp "/cygdrive/v/julia/deps/srccache/UnicodeData-13.0.0.txt" UnicodeData.txt Building PDF documentation. /cygdrive/v/julia/usr/bin/julia --startup-file=no --color=yes `cygpath -w /cygdrive/v/julia/doc/make.jl` -- pdf linkcheck= doctest= buildroot=`cygpath -w /cygdrive/v/julia` texplatform= revise= ┌ Warning: The active manifest file has dependencies that were resolved with a different julia version (1.9.0-DEV). Unexpected behavior may occur. └ @ V:\julia\doc\Manifest.toml:0 [ Info: SetupBuildDirectory: setting up build directory. [ Info: Doctest: skipped. [ Info: ExpandTemplates: expanding markdown templates. [ Info: CrossReferences: building cross-references. [ Info: CheckDocument: running document checks. [ Info: Populate: populating indices. [ Info: RenderDocument: rendering document. [ Info: LaTeXWriter: creating the LaTeX file. [ Info: LaTeXWriter: using latexmk to compile tex. ```

issue

I think compile time < 10min is acceptable.

If all tex files are exported and compiled 3 times in draft mode using lualatex, it only takes about 4 minutes. This means that about 90% of the time is spent on generating code highlights via the minted macro package.

Note: "draft mode" means that there is no code highlighting, all code is black. The rest of the document remains unchanged.

cmd x3: lualatex -interaction=batchmode -halt-on-error -shell-escape -recorder "TheJuliaLanguage.tex"

Possible solution

—— using pythontex package https://github.com/gpoore/pythontex

I answered this question, and in the process did some informal benchmarking of pythontex vs. minted. Summary: on my system, 40 simple uses of \mint take about 12 s to compile, and 80 uses needs about 23 s. With pythontex, 40 equivalent commands need 3.5 s, 80 uses is almost the same, and you only get to around 23 s for 8000 uses. All the pythontex numbers are actually overestimates for typical use, since highlighted results are cached. —— https://tex.stackexchange.com/a/61342

ViralBShah commented 1 year ago

I believe most of the time is spent in pygmentize. Agree that this is too long, and it would be nice to be quicker.

tecosaur commented 1 year ago

It's worth noting in the PythonTeX manual (footnote 5 on page 6):

The author recently started maintaining the minted package. In the near future, minted will inherit PythonTEX’s speed enhancements, and the two packages will become more compatible.

That was from 2021 though, so I don't know if this has happened or not?