[Mono-dev] [PATCH] String.Split() broken behavior

Tyler Larson mono-devel at tlarson.com
Fri Oct 26 14:18:30 EDT 2007

Paolo Molaro wrote:
> On 10/18/07 mono-devel at tlarson.com wrote:
>> On the contrary, the code IS optimized, which is why I removed it that 
> Well, moving the code to always transition to unmanaged is not much
> of an optimization.

Understood. Note, however, that the optimization I'm talking about comes 
comes from a redesign of the underlying split algorithm rather than 
simply running unmanaged.

The whole reason why the unmanaged code was modified at all (as opposed 
to just changing the C# counterpart) is because that's where the code 
that needed to be optimized. The original implementation did what it 
could without changing the unmanaged code, which necessarily resulted in 
an inefficient algorithm. That's why he marked the code as requiring 
optimization. The *only way* to effect that optimization was to optimize 
the unmanaged code, and remove the kludge in the C# code.

The relevant detail here is that the original author recognized that his 
implementation was sub-optimal, but didn't know it was also incorrect, 
hence the optimization attribute. The patch removes his algorithm 
completely, replacing it with something fundamentally different. The 
optimization attribute should be removed because the algorithm to which 
it applies is no longer present. I didn't want to make a big deal about 
it; it was just the appropriate thing to do.

More information about the Mono-devel-list mailing list