[Mono-dev] [PATCH]UInt32.Parse optimization
Prakash Punnoor
prakash at punnoor.de
Wed Nov 14 14:28:07 EST 2007
Hi,
a small optimization which gives me about 7% speed gain.
--- UInt32.cs.old 2007-11-14 20:24:38.359166220 +0100
+++ UInt32.cs 2007-11-14 20:25:18.031114016 +0100
@@ -137,9 +137,8 @@
for (; i < len; i++) {
c = s [i];
- if (c >= '0' && c <= '9') {
- uint d = (uint) (c - '0');
-
+ uint d = (uint) (c - '0');
+ if (d <= 9) {
if ((val > MaxValue/10) || (val ==
(MaxValue / 10) && d > (MaxValue % 10))){
if (!tryParse)
exc = new
OverflowException (Locale.GetText ("Value is too large"));
Cheers,
--
(°= =°)
//\ Prakash Punnoor /\\
V_/ \_V
-------------- next part --------------
A non-text attachment was scrubbed...
Name: parse_u32.patch
Type: text/x-diff
Size: 470 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20071114/f5c5d4bb/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20071114/f5c5d4bb/attachment-0001.bin
More information about the Mono-devel-list
mailing list