[Mono-devel-list] String compare changes

Dick Porter dick at ximian.com
Thu Dec 4 07:59:21 EST 2003


On Wed, 2003-12-03 at 00:47, Bernie Solomon wrote:
> Also the code seems to do some (in my view) unnecessary conversions
> from the mono string format to UChar which could be more efficient.
> 
> I believe UChar == gunichar2 == platform endian unicode character
> so none of these conversions are necessary and pointers into the
> MonoString itself can be used to feed into the collation routines. (UChar
> is documented as 16 bit and I presume gunichar2 is too).

I think you're correct.  I just need to verify that UChar is always
platform-endian.

Some other people have commented that culture-aware String compares are
rather slower than the basic memcmp()s that used to be done.  One thing
you can do when benchmarking is set LANG=C (or unset LANG altogether),
which will set the default culture to the Invariant and will
short-circuit the ICU stuff and use the old code.  I've also noted the
issues with lots of Substring() calls, and will be fixing those.

- Dick





More information about the Mono-devel-list mailing list