Closed user202729 closed 9 months ago
In 2D, all Asymptote does is create independent TeX files (one for each shipout), which are then processed with the specified TeX engine. I don't think one would want to concatenate them together into the bidirectional interactive pipe used for sizing purposes. Even if was possible to merge and then decouple the TeX processing of multiple shipouts somehow, I'm not even sure how efficient that would be.
It's indeed not possible to combine multiple shipout into one TeX call, nevertheless it's at least possible to combine the final shipout (the one automatically inserted if there's no shipout) into the bidirectional interactive pipe.
I think the most common use case is that there's only one (implicit) shipout, so we would save one engine startup+preamble processing.
When I run
asy -vvv a.asy
(for any content ofasy
e.g. hello world file), it appears that PDFLaTeX is called twice -- the first time to measure the size of the boxes, the second time to actually shipout everything.Is there any reason (apart from that we cannot know in advance when is the last
shipout
, but in the special case that one is automatically inserted at the end, we in fact can know) why it's not merged into one call, in order to save time?My rough estimation is that each PDFLaTeX compilation takes 0.3 second (or 0.7 second for LuaLaTeX, more if heavy packages are used in preamble), so optimizing it would save quite a bit of compilation time.