[ 
https://issues.apache.org/jira/browse/PDFBOX-3382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15339078#comment-15339078
 ] 

kazu edited comment on PDFBOX-3382 at 6/20/16 7:20 AM:
-------------------------------------------------------

Thank you for your quick response!

Yeah, multithreading issues are hard to solve and "synchronized" often hurts a 
lot...

I wasn't sure which snapshot to use, so I used the following ones:
2.0.3:  pdfbox-20, fontbox-21
2.1.0:  pdfbox-107, fontbox-110

Benchmarks:

provided test-script:
old version:            ~5,6 sec
snapshot 2.1.0: ~3,0 Sec
snapshot 2.0.3: ~2,9 sec

provided test-script + getStringWidth() for every line
old version:            ~9,0 sec
snapshot 2.1.0: ~4,5 Sec
snapshot 2.0.3: ~4,2 sec

original document (2048 PDFs)
old version:            ~17.4
snapshot 2.1.0: ~11.6
snapshot 2.0.3: ~10.7


Profiling snapshot 2.0.3
nameToGid() and hasGlyph() disappeared from the critical outputs :)

what remains:
PDFont.getWidth()       [31%]
PDFont.encode() [15%]
FlateFilter.encode()    [13%]


was (Author: kazu):
Thank you for your quick response!

Yeah, multithreading issues are hard to solve and "synchronized" often hurts a 
lot...

I wasn't sure which snapshot to use, so I used the following ones:
2.0.3:  pdfbox-20, fontbox-21
2.1.0:  pdfbox-107, fontbox-110

Benchmarks:

provided test-script: 
old version:            ~9,0 sec
snapshot 2.1.0: ~4,5 Sec
snapshot 2.0.3: ~4,2 sec


original document (2048 PDFs)
old version:            ~17.4
snapshot 2.1.0: ~11.6
snapshot 2.0.3: ~10.7


Profiling snapshot 2.0.3
nameToGid() and hasGlyph() disappeared from the critical outputs :)

what remains:
PDFont.getWidth()       [31%]
PDFont.encode() [15%]
FlateFilter.encode()    [13%]

> pdf creation very slow
> ----------------------
>
>                 Key: PDFBOX-3382
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3382
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: FontBox, Writing
>    Affects Versions: 2.0.2, 2.0.3, 2.1.0
>            Reporter: kazu
>            Priority: Minor
>              Labels: optimization, performance
>             Fix For: 2.0.3, 2.1.0
>
>
> compared to older 1.8.x versions, the new 2.0.x branch is awesomely slow.
> benchmarks using a multipage document with few images and many text-lines 
> indiciate a performance penalty of about 1:20 compared with the old 1.8.x 
> branch.
> profiling via VisualVM indicates that the new font handling causes this 
> performance drawback:
> TrueTypeFont.nameToGid() [31%]
> TrueTypeFont.hasGlyph() [23%]
> PDFont.getWidth() [16%]
> PDType1Font.encode() [9%]
> is there any workaround for this? the current setup only creates about 10 
> PDFs/second compared to over 200/second for the 1.8.x branch...



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to