[Mono-bugs] [Bug 82365][Maj] New - WebClient Performance loss from 1.x to 2.x

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Aug 8 01:57:11 EDT 2007


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 miguel at ximian.com.

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

--- shadow/82365	2007-08-08 01:57:11.000000000 -0400
+++ shadow/82365.tmp.28687	2007-08-08 01:57:11.000000000 -0400
@@ -0,0 +1,65 @@
+Bug#: 82365
+Product: Mono: Class Libraries
+Version: 1.0
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: miguel at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: WebClient Performance loss from 1.x to 2.x
+
+The WebClient has had a performance loss in going from 1.x to 2.x, the
+following program on a fast network will yield slower results if compiled
+with gmcs:
+
+using System;
+using System.IO;
+using System.Net;
+
+class Test {
+        static void Main (string[] args) {
+                string url = args[0];
+                WebClient wc = new WebClient();
+                DateTime start = DateTime.Now;
+                wc.DownloadFile(url, "downloaded");
+                TimeSpan elapsed = DateTime.Now - start;
+                FileInfo info = new FileInfo("downloaded");
+                long length = info.Length;
+                Console.WriteLine("{0} kB/s", (length / 1024.0) /
+elapsed.TotalSeconds);
+        }
+}
+
+I instrumented the code in DownloadFile to ensure that the time was
+actually being spent in the body of the download routine instead of the
+various configuration (that are quite different between 1.x and 2.x and
+that pollute the --trace output).
+
+One interesting observation is that for a large download, I noticed this by
+sorting the output of trace:
+
+for mcs, the top counts for method calls:
+    222 LEAVE: (wrapper managed-to-native)
+System.Threading.Monitor:Monitor_try_enter (object,int)TRUE:1
+    223 LEAVE: (wrapper managed-to-native)
+System.Threading.Monitor:Monitor_exit (object)
+    256 LEAVE: System.Threading.Monitor:Exit (object)
+    293 LEAVE: System.Threading.Monitor:Enter (object)
+
+for gmcs:
+    621 LEAVE: (wrapper managed-to-native)
+System.Threading.Monitor:Monitor_try_enter (object,int)TRUE:1
+    640 LEAVE: (wrapper managed-to-native)
+System.Threading.Monitor:Monitor_exit (object)
+    769 LEAVE: System.Threading.Monitor:Enter (object)
+    776 LEAVE: System.Threading.Monitor:Exit (object)
+
+We might be too trigger happy with the locks in 2.x


More information about the mono-bugs mailing list