Otherspdflatex slow

Information and discussion about other tools not listed above.
Post Reply
huthoos
Posts: 4
Joined: Wed Jan 06, 2010 2:01 pm

pdflatex slow

Post by huthoos »

I would like to attach files into PDF files using the attachfile package. pdflatex seems to write these attachments rather slowly even if all files are in a directory in tmpfs (in memory). It takes a few seconds to attach a 5 MB file although dd is able to write about 500 MB/second. While pdflatex is attaching the file it consumes 100% CPU. The resulting real PDF file is on a CIFS mounted directory which makes it even slower. dd can write about 20 MB/s to these CIFS mounted directories if I set block size to a sufficiently high value, say 1 MB, so writing a 1 MB file should ideally take about 0.05 seconds but it takes about 1 second for pdflatex to attach a 1 MB file to the CIFS mounted PDF file. I have experimented with mount.cifs options but they do not seem to affect the writing speed. Is there any way to tune pdflatex's I/O performance?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

huthoos
Posts: 4
Joined: Wed Jan 06, 2010 2:01 pm

Re: pdflatex slow

Post by huthoos »

Autoreply: It seems that pdflatex applies compression to the attachments. If I attach files which contain plain zeros (e.g. from /dev/zero), then the attachment process is very fast and the resulting pdf file is very small. For example,

- a random 5242880 byte (5 MiB) file attached 10 times => 52465478 byte (50 MiB) pdf
- a null 5242880 byte (5 MiB) file attached 10 times => 69551 byte (0.07 MiB) pdf

The random files are much more expensive to attach than the zero files.

pdftex can be instructed to turn off compression by including \pdfcompresslevel0 in the source file. At least hyperref seems to turn compression on. Turning compression off seems to speed up the attaching somewhat but not to the level of OS copy command.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

pdflatex slow

Post by localghost »

Now that the problem seems to be solved, please be so kind and mark the topic (not the last post) accordingly as clearly written in the Board Rules (to be read before posting). Otherwise tell us what is missing. Please keep that in mind for the future so that further reminders will not be necessary.


Thorsten
Post Reply