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

Petr Slaby commented on PDFBOX-2131:
------------------------------------

> However I believe that the first debug log statement in the patch will never 
> be called because it is after the return.
Yes, I forgot to mention. I have moved the LOG.debug() line out of the if() in 
Encoding.java, because from the log message I conclude that this was the 
original intention - report characters that were requested but not found in the 
NAME_TO_CHARACTER map.

> Avoid constructing debug messages if debug log is off
> -----------------------------------------------------
>
>                 Key: PDFBOX-2131
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2131
>             Project: PDFBox
>          Issue Type: Improvement
>    Affects Versions: 2.0.0
>            Reporter: Petr Slaby
>            Priority: Trivial
>         Attachments: DebugLog.patch
>
>
> Concatenation and formatting of strings takes some time. If a debug message 
> is written to the log at a frequently called place, it should be surrounded 
> by an if(LOG.isDebugEnabled()). Using the if everywhere does not do any harm 
> either.
> Attached patch changes two classes which were sticking out in the profiler. 
> The difference in performance is not that big, but, in my application, each 
> millisecond counts.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to