[Mono-bugs] [Bug 56295][Maj] New - Critical thread performance

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 31 Mar 2004 11:58:06 -0500 (EST)


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 joannes.vermorel@ens.fr.

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

--- shadow/56295	2004-03-31 11:58:06.000000000 -0500
+++ shadow/56295.tmp.18775	2004-03-31 11:58:06.000000000 -0500
@@ -0,0 +1,92 @@
+Bug#: 56295
+Product: Mono: Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Major
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: joannes.vermorel@ens.fr               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Critical thread performance
+
+Description of Problem:
+
+I encountered critical performance issues with a simple multithreaded 
+application using MINT in benchmark against the .Net framework 1.1.
+
+Steps to reproduce the problem:
+1. Run the following the program.
+
+using System;
+using System.Threading;
+
+class HTBench
+{
+  private static int ITERATION_COUNT = 10000000;
+
+  private static long dummy = 0;
+
+  [STAThread]
+  static void Main(string[] args) {
+    Compute();
+    for(int i = 1; i < 16; i *= 2) {		{
+      Thread[] threads = new Thread[i];
+      
+    long beforeStart = DateTime.Now.Ticks;
+    for(int j = 0; j < threads.Length; j++)
+      threads[j] = new Thread(new ThreadStart(Compute));
+
+    for(int j = 0; j < threads.Length; j++) 
+      threads[j].Start();
+
+    for(int j = 0; j < threads.Length; j++)
+      threads[j].Join();
+
+    long afterStart = DateTime.Now.Ticks;
+
+    Console.WriteLine("#thread={0}; time(ms)={1}", i, 
+      (afterStart - beforeStart) / TimeSpan.TicksPerMillisecond);
+  }
+}
+
+  private static void Compute() {
+    int i = 0;
+    while(i < ITERATION_COUNT) i = Increment(i);
+    dummy += i;
+  }
+
+  static int Increment(int i) { return i + 1; }
+}
+
+Actual Results (Console Output):
+
+(with mint of mono-0.31)
+#thread=1; time(ms)=5608
+#thread=2; time(ms)=11296
+#thread=4; time(ms)=22543
+#thread=8; time(ms)=45044
+
+Expected Results (Console Output):
+
+(with .Net framework 1.1)
+#thread=1; time(ms)=40
+#thread=2; time(ms)=60
+#thread=4; time(ms)=60
+#thread=8; time(ms)=120
+
+How often does this happen? 
+All the time.
+
+Additional Information:
+
+The test was run of a Windows XP, 1.3Gz Centrino Laptop with 512Mb of 
+ram. The interpretation of the here above benchmark is that Mint is 
+actually 100x slower than .Net 1.1 on this example. I have no explanation 
+for such behavior.