[Mono-bugs] [Bug 77382][Min] Changed - System.Uri ctor could be faster

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Mar 13 04:49:46 EST 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by pawel.sakowski at mind-breeze.com.

http://bugzilla.ximian.com/show_bug.cgi?id=77382

--- shadow/77382	2006-03-10 03:46:14.000000000 -0500
+++ shadow/77382.tmp.8394	2006-03-13 04:49:45.000000000 -0500
@@ -49,6 +49,36 @@
 It would be nicer if we can reduce extra allocation.
 
 One concern is that cultude dependent code should be avoided. So
 please replace String.StartsWith() with CompareInfo.IsPrefix(). Can
 you also please provide some performance comparison results with
 reproducible code?
+
+------- Additional Comments From pawel.sakowski at mind-breeze.com  2006-03-13 04:49 -------
+- "reduce extra allocation": the attached patch does just that.
+
+- "culture dependent code should be avoided": also done by the patch
+
+- "CompareInfo.IsPrefix": actually, since only 1- or 2-character
+prefixes are checked in Uri, I did explicit char-by-char comparison
+
+- "performance comparison": as stated above, 19 vs 25 allocations in
+the trivial case. A practical test of the execution time impact would
+involve a non-trivial amount of code to produce enough load on the CPU
+and GC to make the difference matter (this happened on a production
+system, but a small self-contained test case can hardly be extracted
+from it). Also, as stated above, the 19-25 allocation difference
+doesn't take into account the allocations made due to
+Mono.Globalization use, simply because they didn't occur after
+isolating a test case anymore. The reason for that is irrelevant to
+this bug report.
+
+I didn't preserve the test case I used, but it was basically just about:
+
+static void Main() {
+for(int i=0; i<10000; i++) {
+new Uri("http://something/");
+}
+}
+
+Hope this helps.
+


More information about the mono-bugs mailing list