[tex4ht] what is the fastest way to convert large document to HTML?

Martin Gieseking martin.gieseking at uos.de
Sat Aug 18 08:24:02 CEST 2018


Am 18.08.2018 um 00:26 schrieb Karl Berry:
> Martin: please see https://tug.org/pipermail/tex4ht/2018q3/001984.html
> and thread following about slow operation handling a huge document (not
> surprising in my view).
> 
> Is it perhaps possible to cache results so that dvisvgm does not have to
> recompute every math fragment every time? Any other possibilities come
> to mind?


As far as I can tell, there isn't much you can do to speed up the 
conversion process of dvisvgm itself. Every DVI document requires some 
time-consuming computations that can't be accelerated easily. 
Especially, the conversion of fonts/glyphs to SVG equivalents slow 
things down. It gets even more complicated if PostScript code is 
involved and/or you have to process thousands of DVI files or pages.

However, technically it shouldn't be necessary to convert all math 
fragments every time the document is processed. In the (proprietary) 
infrastructure at our university we only convert the portions that have 
actually changed. This is simply done by using md5-based file names 
computed from the corresponding LaTeX code. Before starting the actual 
conversion, the system checks if there's already an SVG file present 
which matches the hash value of the LaTeX code. If so, running LaTeX and 
dvisvgm can be skipped. This also has the advantage that every fragment 
is created only once even if it's referenced multiple times in the document.

Since my knowledge of TeX4ht is pretty limited, I don't know if it's 
possible to realize a similar mechanism here.

Regards,
Martin


More information about the tex4ht mailing list