[jboss-jira] [JBoss JIRA] (LOGTOOL-45) Avoid unnecessary calls to String#format()

Gunnar Morling (JIRA) jira-events at lists.jboss.org
Fri Mar 30 09:49:48 EDT 2012


    [ https://issues.jboss.org/browse/LOGTOOL-45?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12680635#comment-12680635 ] 

Gunnar Morling edited comment on LOGTOOL-45 at 3/30/12 9:49 AM:
----------------------------------------------------------------

{quote}
We could maybe add a third formatting option like NOFORMAT for messages, and forbid arguments from being specified.
{quote}

Ah, I was just about to propose something along these lines :-)

Admittedly, the overhead due to the formatting is not huge, but when profiling Hibernate Validator, the calls to {{String#format()}} caught my attention. 
                
      was (Author: gunnar.morling):
    > We could maybe add a third formatting option like NOFORMAT for messages, and forbid arguments from being specified.

Ah, I was just about to propose something along these lines :-)

Admittedly, the overhead due to the formatting is not huge, but when profiling Hibernate Validator, the calls to {{String#format()}} caught my attention. 
                  
> Avoid unnecessary calls to String#format()
> ------------------------------------------
>
>                 Key: LOGTOOL-45
>                 URL: https://issues.jboss.org/browse/LOGTOOL-45
>             Project: Log Tool
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>            Reporter: Gunnar Morling
>            Assignee: James Perkins
>
> Generated message bundle methods always contain an invocation of {{String#format()}} also if there actually is no parameter to be replaced, e.g. like this:
> {code}
> @Override
> public final String mustNotBeNull() {
>     String result = String.format(mustNotBeNull0$str());
>     return result;
> }
> {code}
> AFAICS the invocation of {{format()}} seems superfluous, instead the String might directly be returned for performance reasons.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list