[Mono-devel-list] [Patch] First patch for making String managed

Andreas Nahr ClassDevelopment at A-SoftTech.com
Tue Jun 1 11:48:10 EDT 2004

The code duplication is intentionally at this point. If you look at it you
can see that creating one implementation and then calling these would only
save a few LOC for the 12 methods implemented. However as they don't get
inlined the speed loss would be substantial (e.g. IndexOf  782ms -> 1262ms).
As corlib should get ngen'ed at some point anyway I personally think that
about 50 bytes additional IL (for all 12 methods) for 80% speed improvement
is a pretty good investment. String is probably the most used class out
there, so it should be well worth it.


P.S. I don't  have any 'just runnable' benchmark available for that as I
just have a file that I tailor for my needs. I'll attach it, but I think its
pretty useless for someone else, as it requires constant modification.

----- Original Message ----- 
From: "Ben Maurer" <05mauben at hawken.edu>
To: <ClassDevelopment at A-SoftTech.com>; <mono-devel-list at lists.ximian.com>
Sent: Tuesday, June 01, 2004 4:30 PM
Subject: Re: [Mono-devel-list] [Patch] First patch for making Stringmanaged

There is way too much code duplication here. Please have *one*
implementation for each method and have the overloads call there.

>>> "Andreas Nahr" <ClassDevelopment at A-SoftTech.com> 06/01/04 10:06 AM >>>

This is a patch that gets all IndexOf - kind methods dealing with chars into
the managed realm.
Please test and provide feedback.

Here are some microbenchmark results (especially cool are the results for
IndexOfAny and LastIndexOfAny):

IndexOf (17): 1132 -> 791
IndexOf (2162): 10576 -> 7862

LastIndexOf (similar to above)

IndexOfAny (long string, nothing found): 25867 -> 2984

LastIndexOfAny  (similar to above)


Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com

More information about the Mono-devel-list mailing list