[Mono-list] String comparisons slow
Stifu
stifu at free.fr
Thu Jul 22 02:24:40 EDT 2010
Yeah, from what I read and understand, Ordinal is faster because it checks
characters one by one, sequentially, while Invariant does more complex
checks.
By the way, it's "résumé", not "rèsumè". ;)
Bojan Rajkovic-2 wrote:
>
> Hi Alexander,
>
> My understanding based on the documentation is that
> StringComparison.Ordinal
> is essentially a C strcmp (in fact, it may be implemented as such under
> the
> hood, via an icall to the C runtime code), and StringComparison.Invariant
> is
> aware of surrogate pairs and composed characters, and is a linguistic
> comparison (ie. this *letter* comes before the other, not this character
> code).
>
> --Bojan
>
> 2010/7/22 Alexander M. Batishchev <abatishchev at godfather.net.ru>
>
>> Michael, could you please clarify the difference between Ordinal and
>> Invariant string comparison?
>>
>> -----Original Message-----
>> From: mono-list-bounces at lists.ximian.com
>> [mailto:mono-list-bounces at lists.ximian.com] On Behalf Of Michael
>> Hutchinson
>> Sent: Thursday, July 22, 2010 12:29 AM
>> To: David S
>> Cc: mono-list at lists.ximian.com; wtftc
>> Subject: Re: [Mono-list] String comparisons slow
>>
>> On Wed, Jul 21, 2010 at 3:30 PM, David S <buttink at gmail.com> wrote:
>> > Ok. Now I'm confused. How come "CurrentCulture" for US/ENG doesn't just
>> run
>> > the Ordinal??? Perhaps there are some weird alphabetizing things I just
>> > don't understand. BTW, Thanks for tell us about the StringComparer
>> class.
>> I
>> > never knew that existed.
>>
>> Note also that some string methods have overloads for taking specific
>> cultures, or the StringComparison enum. Both StringComparison.Ordinal
>> and StringComparison.OrdinalIgnoreCase (as well as StringComparer) can
>> be very useful to improve performance when culture-dependent behaviour
>> is not needed or desirable.
>>
>> Culture-dependent string comparisons are a very complex topic. There's
>> also an "invariant" culture for doing things in a culture-independent
>> way.
>>
>> --
>> Michael Hutchinson
>> http://mjhutchinson.com
>> _______________________________________________
>> Mono-list maillist - Mono-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-list
>>
>> _______________________________________________
>> Mono-list maillist - Mono-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-list
>>
>
> _______________________________________________
> Mono-list maillist - Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>
--
View this message in context: http://mono.1490590.n4.nabble.com/String-comparisons-slow-tp2296525p2298183.html
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list
mailing list