[tex4ht] speed of compiling to HMTL vs. PDF

Michal Hoftich michal.h21 at gmail.com
Sun Nov 7 10:44:41 CET 2021


Hi Nasser,

>
> Is there a rule of thumb one can use to compare how long a document
> takes to compile to pdf vs. html?
>

Usually, the processing of the document preamble takes much more time,
depending on the used packages, as all .4ht files need to be loaded,
some of them multiple times. The document body shouldn't take much
more time than in PDF.


> I have a large document, 22,200 pages in PDF. Compiling it using
> lualatex takes about 20-25 minutes.  Compiling using make4ht and
> using mathjax mode, it takes over 6 hrs.
> Is this something to be expected? about 12 times longer?
>


No, this is not to be expected. I would expect something like + 40 %.

> I would expect this to happen if I am using svg for images as
> before, but since I am using mathjax, I thought things should
> be faster.
>

Sure. Although we use LaTeX 3 regexes in the MathJax mode, so maybe it
can take some time if there is a huge amount of math.

> The command I use to compile to HTML is (all on one line)
>
> make4ht --shell-escape -ulm default -a debug
>    -c nma_mathjax.cfg -e config.lua filename.tex
>    "mathjax,htm,fn-in,4,notoc*,p-width,charset=utf-8" " -cunihtf -utf8"
>
> So split level is 4 above.
>

Try -m draft, you compile your document three times for every run,
which is unnecessary in most cases. It should cut the compilation time
by almost two thirds.

> The file is 80% math equations, and about 200-300 images.
>

It is possible that you use some environments that are still not
supported by the MathJax mode, if you have so many pictures.
You can also try -f html5+dvisvgm_hashes to speedup the picture generation.

> Using TL 2021, and I run the above on Ubuntu under the updated
> windows 10 Linux subsystem. I wonder if this has
> something to do with it or is this just the way how tex4ht works?
>

I think Windows are generally slower for TeX, but it must be something
caused by your files, for this big difference between normal LaTeX and
TeX4ht.

Best regards,
Michal


More information about the tex4ht mailing list.