[Mono-devel-list] String Allocation in StringBuilder.AppendFormat
bmaurer at users.sourceforge.net
Wed Aug 20 13:39:31 EDT 2003
On Wed, 2003-08-20 at 11:34, Ben Maurer wrote:
> On Wed, 2003-08-20 at 09:10, Paolo Molaro wrote:
> > On 08/20/03 Ben Maurer wrote:
> > > Looking at the StringBuilder.AppendFormat code, it just does:
> > > Append (String.Format (...));
> > >
> > > Inside the Format code, a new StringBuilder is allocated to handle the
> > > formatting.
> > [...]
> > > I suggest that we move the format parsing logic to StringBuilder.
> > I don't see any reason to move the code around. Just change the current
> > String.Format to an internal method String.FormatHelper that takes
> > an additional argument, a StringBuilder. This way it can be used
> > directly by the StringBuilder.AppendFormat functions and String.Format
> > becomes:
> > StringBuilder s = new StringBuilder ();
> > FormatHelper (s, ...);
> > return s.ToString ();
> Ok, Implementing this right now, a patch is coming in a bit.
Here is the patch.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2730 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20030820/c8056bb6/attachment.bin
More information about the Mono-devel-list