Domas Mituzas wrote:
Did you do any benchmarks? Because that's what I thought we'd do before rolling it live on wikipedia ;-) How much faster is the dvipng approach?
My tests indicate a factor 3.
I don't have a MediaWiki server to try it on, nor any real knowledge of ocaml, so I wrote a small python snippet that re-rendered the same image again and again, using the os.system() call.
Based on other experience, I expected something like two orders of magnitude more, but here, the repetitive call to dvipng on a one-page DVI makes for an overhead in startup time. Example:
100 one-page DVIs, one image per DVI, dvips->convert: 120 s 100 one-page DVIs, one image per DVI, dvipng: 39 s, a factor 3
(my machine, YMMV)
If one is willing to put in some more work instead of my simpleminded patch there is more to gain, say if one were to collect math into larger DVI files:
100-page DVI, one image per page, dvipng: 0.5 s, a factor 240
This collection of images is perhaps not desirable in MediaWiki. But it is also entirely possible to run dvipng in deamon mode, telling it which DVI to render and the desired output file...
100 one-page DVIs, one image per DVI, deamon dvipng: 1 s, a factor 120
That would of course increase with the number of DVIs you render. The startup/shutdown of the program is 0.4 s, so each DVI rendered is 0.6/100=0.006 s. Compare that to the 1.2 s via the dvips->convert route. If startup is done _once_ and all images rendered with an already running dvipng, the factor is 200. This would involve having a dvipng process running indefinitely on the server, but makes for interesting prospects, no?
/JÅ