[logback-dev] [JIRA] Commented: (LBCLASSIC-111) Improve performance by removing StringBuffer where possible

Thorbjoern Ravn Andersen (JIRA) noreply-jira at qos.ch
Sun Mar 15 22:22:10 CET 2009


    [ http://jira.qos.ch/browse/LBCLASSIC-111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11087#action_11087 ] 

Thorbjoern Ravn Andersen commented on LBCLASSIC-111:
----------------------------------------------------

Can you provide profiler data on where this would benefit significantly in logback?

> Improve performance by removing StringBuffer where possible
> -----------------------------------------------------------
>
>                 Key: LBCLASSIC-111
>                 URL: http://jira.qos.ch/browse/LBCLASSIC-111
>             Project: logback-classic
>          Issue Type: Bug
>    Affects Versions: 0.9.15
>         Environment: any
>            Reporter: Rick Beton
>            Assignee: Logback dev list
>            Priority: Minor
>
> StringBuffer is used in some local variables. The newer StringBuilder alternative will improve the performance slightly in such cases.
> E.g.in FileNamePattern
>   public String convert(Object o) {
>     Converter<Object> p = headTokenConverter;
>     StringBuffer buf = new StringBuffer();
>     while (p != null) {
>       buf.append(p.convert(o));
>       p = p.getNext();
>     }
>     return buf.toString();
>   }
> should change to use
>     StringBuilder buf = new StringBuilder();

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the logback-dev mailing list