Hi,

The attached patch implements String.Trim and the related methods in pure
managed code. It also contains a few optimizations that will speed up the
calls by a considerable amount. A big goal was to optimize common cases
(like the Trim call without parameters).
>From some testing:
"               H ".Trim(): 7441 -> 2754 (+170%)
"Test".Trim(null) : 1332 -> 421 (+216%)
"HAAAAAAAAAAAAAAHAH".Trim( new Char[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', '
' }): 631 -> 550 (+14%)
"HAAAAAAAAAAAAAAHAH".TrimEnd(): 1820 -> 1290 (+41%)
tests with custom trims AND lots of characters that get trimed like:
"               H ".Trim( new Char[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', '
' }): 6350 -> 9303 (-46%)
got slower. The reason for that is obviously that the c-code gets better
optimization than the c# code and the overhead of the managed impl. is a
little bit higher.


Please review and commit the patch.

Other small changes:
* Added MonoTodos to some methods that are currently incorrectly implemented
* Added a CharCopy
* Slightly optimized the Concat Methods

The patch does not remove the unused code from mono itself as I'm not really
comfortable hacking inside the runtime, feel free to remove the now-unused
ves_icall_System_String_InternalTrim in string-icalls.

Greetings
Andreas

Attachment: String.patch
Description: Binary data

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to