[Mono-devel-list] StringBuilder patch

Ben Maurer bmaurer at users.sourceforge.net
Wed Jan 14 15:59:50 EST 2004


On Wed, 2004-01-14 at 11:02, Paolo Molaro wrote:
> If you know you're going to hold the strings and if there is a lot of
> wasted space, you can copy the strings yourself (sb.Subsctring is likely
> to do that on all the sb implementations).

Very interesting idea, I had never thought of that. That pretty much
gets rid of the problem.
> FWIW, a corlib compile wasted about 700KB and only half of the ToString
> calls are in the tokenizer, so, assuming all of them get kept around
> (unlikely)
The tokenizer stuff is kept around for the whole execution.

> The check likely needs to be more complete, since for large strings it's
> going to needlessly copy a lot of data around, but the point is that the
> issue can be fixed in the current stringbuilder for everyone, there is no 
> need to keep an ugly version of the code around.

Ok, now that i see that the substring trick works if you need to
customize, i am fine.

-- ben




More information about the Mono-devel-list mailing list