You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tomasz Pawlak (JIRA)" <ji...@apache.org> on 2015/11/12 11:49:10 UTC

[jira] [Updated] (PDFBOX-3103) Slow performance when printing PDF (fix provided)

     [ https://issues.apache.org/jira/browse/PDFBOX-3103?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tomasz Pawlak updated PDFBOX-3103:
----------------------------------
    Description: 
When printing a PDF document (4 pages, 177KB, link below) using command
{code}
java -jar pdfbox-app-2.0.0-RC1.jar PrintPDF test.pdf
{code}
processing of the document before print takes about 15 seconds on system with Core i5-4670 processor. 

Most of the time is wasted on reading font files from system. The reason is that the font is read byte by byte in an unbuffered manner. The defective code is located in class {{org.apache.fontbox.ttf.RADDataStream}}, where new instance of {{RandomAccessFile}} is created without buffering.

I prepared a buffer wrapper over {{RandomAccessFile}} that adds buffering to {{RandomAccessFile}}. Use of the buffer in {{RADDataStream}} shortens printing time *5 times*, i.e., printing takes 3 seconds instead of 15s.

The wrapper class is augmented version of a class released at https://code.google.com/p/jmzreader/wiki/BufferedRandomAccessFile (Apache License 2.0).

Please integrate provided fix with original source of FontBox.

Files are 

  was:
When printing a PDF document (4 pages, 177KB, link below) using command
{code}
java -jar pdfbox-app-2.0.0-RC1.jar PrintPDF test.pdf
{code}
processing of the document before print takes about 15 seconds on system with Core i5-4670 processor. 

Most of the time is wasted on reading font files from system. The reason is that the font is read byte by byte in an unbuffered manner. The defective code is located in class {{org.apache.fontbox.ttf.RADDataStream}}, where new instance of {{RandomAccessFile}} is created without buffering.

I prepared a buffer wrapper over {{RandomAccessFile}} that adds buffering to {{RandomAccessFile}}. Use of the buffer in {{RADDataStream}} shortens printing time *5 times*, i.e., printing takes 3 seconds instead of 15s.

The wrapper class is augmented version of a class released at https://code.google.com/p/jmzreader/wiki/BufferedRandomAccessFile (Apache License 2.0).

Please integrate provided fix with original source of FontBox.


> Slow performance when printing PDF (fix provided)
> -------------------------------------------------
>
>                 Key: PDFBOX-3103
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3103
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: FontBox
>    Affects Versions: 2.0.0
>            Reporter: Tomasz Pawlak
>              Labels: easyfix, easytest, patch, performance
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> When printing a PDF document (4 pages, 177KB, link below) using command
> {code}
> java -jar pdfbox-app-2.0.0-RC1.jar PrintPDF test.pdf
> {code}
> processing of the document before print takes about 15 seconds on system with Core i5-4670 processor. 
> Most of the time is wasted on reading font files from system. The reason is that the font is read byte by byte in an unbuffered manner. The defective code is located in class {{org.apache.fontbox.ttf.RADDataStream}}, where new instance of {{RandomAccessFile}} is created without buffering.
> I prepared a buffer wrapper over {{RandomAccessFile}} that adds buffering to {{RandomAccessFile}}. Use of the buffer in {{RADDataStream}} shortens printing time *5 times*, i.e., printing takes 3 seconds instead of 15s.
> The wrapper class is augmented version of a class released at https://code.google.com/p/jmzreader/wiki/BufferedRandomAccessFile (Apache License 2.0).
> Please integrate provided fix with original source of FontBox.
> Files are 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org