commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <>
Subject [jira] Closed: (LANG-523) StrBuilder is slow
Date Sun, 06 Sep 2009 22:57:57 GMT


Henri Yandell closed LANG-523.

       Resolution: Fixed
    Fix Version/s:     (was: 2.x)

Thanks for the patch Stefan. Applied to 3.0.

svn ci -m "Applying Stefan Zeller's performance improvement to StrBuilder (LANG-523) by doubling
the size of the String in ensureCapacity. Tests indicate a hundredhold improvement in appending
speed, which seems worth the doubling of data size. " 
Sending        src/java/org/apache/commons/lang/
Sending        src/java/org/apache/commons/lang/text/
Transmitting file data ..
Committed revision 811944.

> StrBuilder is slow
> ------------------
>                 Key: LANG-523
>                 URL:
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.4
>            Reporter: Stefan Zeller
>             Fix For: 3.0
>         Attachments: patch.txt,
> 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.

View raw message