[Mono-devel-list] Mono strings 10x slower than .NET
monodevlist at mobydisk.com
Sun Jun 6 11:18:00 EDT 2004
That drops 24 seconds down to 4 seconds, when the diff tool is in
case-sensitive mode. I'll try to rig a cheesy case-insensitive compare
that doesn't worry about locales. That's fine for a diff tool.
1) String.Equals() is about 10x faster than a case-sensitive
String.Compare(string,string,false)! But if the String.Compare() is
case-sensitive, should the performance difference be that significant?
2) It sounds like you guys are aware of the performance issue. So I
will not report the performance difference as a bug/enhancement unless
you want me to.
Thanks very much!
Paolo Molaro wrote:
> On 06/05/04 William Garrison wrote:
>>I just compiled my first application in Mono. It's a code highlighter &
>>diff tool. It runs great under Mono, except that it runs 10 times
>>slower than under .NET! .NET runs my standard test case in 2-3 seconds,
>>while Mono takes 19-23 seconds. The times are the same on both Windows
>>and Linux (RH9) and with the EXE file compiled under both .NET and Mono.
>>I used the --profile option, and the problem appears to be
>>System.String::Compare. My code is unoptimized, and does LOTS of string
>>compares. When profiling, the code took 32 seconds to run, with 24
>>seconds being the string compares.
>>After all that, I want to know:
>>1) What is the current status of string performance under Mono?
> When using culture-sensitive compares it's quite slow, especially if
> mono was compiled with ICU support (collation and other issues add a lot
> of overhead).
> Do you really need the culture-sensitive Compare? CompareOrdinal
> should be slightly faster, especially with mono build without ICU support.
> Or, you may want to use String.Equals() which is tons faster and
> probably what you need to do in a diff-like tool anyway.
>>2) What can I give someone to help demonstrate or track down the problem?
> We know about the compare slowness (I think we discussed it at the
> Boston meeting, too), but nobody had the time yet to through away the
> current ICU/Compare code and rewrite it. See if using Equals() solves
> the issue for you, in the meantime.
More information about the Mono-devel-list