[Mono-bugs] [Bug 68723][Nor] Changed - Performance on long arith

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 24 Oct 2004 15:06:45 -0400 (EDT)


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 bmaurer@users.sf.net.

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

--- shadow/68723	2004-10-24 12:40:15.000000000 -0400
+++ shadow/68723.tmp.9737	2004-10-24 15:06:45.000000000 -0400
@@ -11,13 +11,13 @@
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: writeonlymemory@gmail.com               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
 URL: 
 Cc: 
-Summary: Recursive code runs very slowly
+Summary: Performance on long arith
 
 Description of problem:
 The Mono runtime seems to have a lot of overhead in making a function call.
  I discovered this when implemented a simple 'power' algorithm for a CS
 class -- the O(n) algorithm ran faster than the O(lg n) algorithm in Mono.
  This is clearly bogus.  I later verified that this is NOT the case with
@@ -75,6 +75,28 @@
 
 mono power.exe fast 2 32
 
 It will do the same thing but with (theoretically) a O(lg n)
 algorithm.  With the Microsoft platform, it behaves as expected, but
 with Mono the linear algorithm runs faster.
+
+------- Additional Comments From bmaurer@users.sf.net  2004-10-24 15:06 -------
+Simpler test case:
+
+MS runs this in about 2 s while we take 3 s.
+
+class X {
+	static void Main ()
+	{
+		long x = 0;
+		for (long i = 0; i < 10000000; i ++) {
+			if (i == 2)
+				x = i * i;
+			else if (i % 2 != 0)
+				x = i * (i - 1);
+			else {
+				x = x * (i / 2);
+				x = x * x;
+			}
+		}
+	}
+}