[Mono-dev] [PATCH] Fold a + 'b' + c to a + "b" + c in mcs

Ben Maurer bmaurer at ximian.com
Tue Oct 11 03:06:59 EDT 2005


On Tue, 2005-10-11 at 07:59 +0100, Marek Safar wrote:
> Hello Ben,
> 
> >Today I noticed a perf issue in corlib in a place where we did a + 'b' +
> >c. The constant char in this case needs to be boxed and a string
> >allocated for its value. A better way to write this is a + "b" + c,
> >which saves two allocations.
> >  
> >
> Good idea, so why not extend this to all other constant cases like. "a" 
> + 1 + "c" etc.

ToString there is culture dependent, for char it is not.

-- Ben




More information about the Mono-devel-list mailing list