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

Tilman Hausherr commented on PDFBOX-5779:
-----------------------------------------

Your test code won't work with 3.0.1. Adjusting your code will still result in 
the stream getting read into memory first. Reading font data needs random 
access, so it will be needed to read the full stream first.

I see that your time comes from 1000 iterations. So you're complaining about 
50ms vs 29ms, i.e. a difference of 21ms. You could reduce that by loading the 
TrueTypeFont object outside of the loop, if this is about creating a mass 
mailing.

> Loading font streams has poorer performance compared to loading font files
> --------------------------------------------------------------------------
>
>                 Key: PDFBOX-5779
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5779
>             Project: PDFBox
>          Issue Type: Improvement
>    Affects Versions: 3.0.1 PDFBox
>            Reporter: bai yuan
>            Priority: Major
>         Attachments: arial.ttf, pdfbox.java
>
>
> Run the attached program, then open the code on line 41 and comment out the 
> code on line 44, and compare the time consumption of the two font loading 
> methods.
> Why does using font streams have poorer performance compared to using font 
> files? Is this a limitation? If I can only use font streams, are there any 
> ways to improve performance?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to