You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2009/09/04 11:19:58 UTC

[jira] Updated: (LANG-523) StrBuilder is slow

     [ https://issues.apache.org/jira/browse/LANG-523?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell updated LANG-523:
-------------------------------

    Fix Version/s: 2.x
                   3.0

Confirmed.

> StrBuilder is slow
> ------------------
>
>                 Key: LANG-523
>                 URL: https://issues.apache.org/jira/browse/LANG-523
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.4
>            Reporter: Stefan Zeller
>             Fix For: 3.0, 2.x
>
>         Attachments: patch.txt, Test.java
>
>
> I need a faster StringBuffer for java 1.4 branch.
> So I tested StrBuffer. The result is not sufficient as it is 500 times slower than StringBuffer. The problem is that currently the StrBuilder increases the buffer size by the length of the string that thought to be appended.
> Changing this strategy to provide the double of the needed buffer size brings the performance near to the StringBuilder.
> Here the times (the average of four runs in ms) for the Testcase attached. Where MyStrBuilder is the pathed version of StrBuilder
> startStringBuffer: 	105.25
> startStrBuilder:	5863.75
> startStringBuilder:	55
> startMyStringBuilder: 	54

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.