[Mono-dev] [PATCH] Boost speed of UnicodeEncoding

Atsushi Eno atsushi at ximian.com
Fri Mar 17 05:57:56 EST 2006


Kornél Pál wrote:
> Hi,
>>> I think converting a single character should not be optimized as doing
>>> so is
>>> already inefficient. It's much faster to use convert it inline using
>>> shift
>>> operators.
>> But you already do this test here
>> +        if (byteCount >= 2)
>> +        {
>> just write else section with fast path for 0 and 1 byte count here.
> The attached patch contains some fast paths. I think this is optimal. Note
> that currently I'm not going to modify string.memcpy altough it could be
> optimized because byte-swapped copy is currently faster for short strings
> than string.memcpy.
> Kornél

Cool, thanks Kornél. Can you please commit the patch with a few
coding style fixes?

	foo [i] instead of foo[i]
	Blah () instead of Blah()
	(byte) x instead of (byte)x

The benchmark results are wonderful :)

Atsushi Eno

More information about the Mono-devel-list mailing list