[texhax] Throughput

Heiko Oberdiek heiko.oberdiek at googlemail.com
Fri Mar 4 16:42:07 CET 2011


On Fri, Mar 04, 2011 at 09:18:10AM -0500, William Adams wrote:

> On Mar 3, 2011, at 4:07 PM, Peter Davis wrote:
> 
> > Jonathan Kew suggested putting each graphic in a \box, and simplying copying the boxes where needed.  Does that actually eliminate redundant access to the external PDF files?  That would be great.
> 
> I just tried a short experiment w/ my Thanksgiving card file and judging from the log file, it does. I'll see if I can post the time it takes for the full file to run before the day is out.
> 
> Instead of \copy, I used LaTeX's save boxes though:
> 
> \newsavebox{\insidegraphic}
> \newsavebox{\outsidegraphic}
> \sbox{\outsidegraphic}{\includegraphics{outside.pdf}}
> \sbox{\insidegraphic}{\includegraphics{image/inside.pdf}}
> 
> Which kind of begs the question could this functionality be built into \includegraphics directly?

Some kind of optimizations are already build in, thus that the
same image isn't embedded more than once (e.g. pdftex.def, the
compiler itself might detect same images, ...). However the
graphics package needs to find the file first and get the right
file name:
  \includegraphics{foobar}
  \includegraphics{foobar.png}
can be the same image or different images.
But the same is also true for
  \includegraphics{foobar}
  \includegraphics{foobar}
if they are executed at different settings of \graphicspath.
Also box registers are a limited resource soon (vanilla TeX) or
later (enabled e-TeX extensions) you will hit a limit.

Yours sincerely
  Heiko Oberdiek


More information about the texhax mailing list