[Mono-devel-list] [PATCH] StringBuilder Speedup
Gonzalo Paniagua Javier
gonzalo at ximian.com
Wed Jan 19 16:18:49 EST 2005
On Sat, 2005-01-15 at 23:19 -0500, Ben Maurer wrote:
[...]
> Case 3:
>
> {
> StringBuilder sb = new StringBuilder ();
> sb.Append ("0123456789");
> sb.Append ("0123456789");
> sb.ToString ();
> }
>
> We saved one allocation here. The default size of a StringBuilder is 16.
> However, in the second append, it knows that this will not be large
> enough. So it is able to make its first buffer 32 chars.
I'd rather stick to having the same capacity as they have and growing in
the same way. We already have tests for that and there's no need to
break it fr getting a small speedup or memory saving.
-Gonzalo
More information about the Mono-devel-list
mailing list