[Mono-bugs] [Bug 78642][Wis] Changed - Bad performance of Mono (JIT-compiler)

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Jun 18 16:33:11 EDT 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 bmaurer at users.sf.net.

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

--- shadow/78642	2006-06-16 09:14:02.000000000 -0400
+++ shadow/78642.tmp.23882	2006-06-18 16:33:11.000000000 -0400
@@ -348,6 +348,46 @@
 Some optimizations which can be performed but we don't do it are:
 - conversion of division by / 8 into a right shift when the
   value to be divided is known to be positive ('i' in the inner loop)
 - array bound check removal on the array accesses in the inner loop.
 
 
+
+------- Additional Comments From bmaurer at users.sf.net  2006-06-18 16:33 -------
+The assembly code generated here is unusually bad:
+
+  90:	b9 08 00 00 00       	mov    ecx,0x8
+  95:	8b c6                	mov    eax,esi
+  97:	99                   	cdq    
+  98:	f7 f9                	idiv   ecx
+  9a:	39 47 0c             	cmp    DWORD PTR [edi+12],eax
+  9d:	0f 86 cd 00 00 00    	jbe    170 <PerformanceTest_Main+0x170>
+  a3:	8d 44 07 10          	lea    eax,[edi+eax+16]
+  a7:	0f b6 00             	movzx  eax,BYTE PTR [eax]
+  aa:	89 45 b0             	mov    DWORD PTR [ebp-80],eax
+  ad:	b8 01 00 00 00       	mov    eax,0x1
+  b2:	89 45 ac             	mov    DWORD PTR [ebp-84],eax
+  b5:	b8 07 00 00 00       	mov    eax,0x7
+  ba:	89 45 a8             	mov    DWORD PTR [ebp-88],eax
+  bd:	b9 08 00 00 00       	mov    ecx,0x8
+  c2:	8b c3                	mov    eax,ebx
+  c4:	99                   	cdq    
+  c5:	f7 f9                	idiv   ecx
+  c7:	8b c2                	mov    eax,edx
+  c9:	8b 55 ac             	mov    edx,DWORD PTR [ebp-84]
+  cc:	8b 4d a8             	mov    ecx,DWORD PTR [ebp-88]
+  cf:	2b c8                	sub    ecx,eax
+  d1:	8b 45 b0             	mov    eax,DWORD PTR [ebp-80]
+  d4:	83 e1 1f             	and    ecx,0x1f
+  d7:	d3 e2                	shl    edx,cl
+  d9:	8b ca                	mov    ecx,edx
+  db:	23 c1                	and    eax,ecx
+  dd:	89 45 f0             	mov    DWORD PTR [ebp-16],eax
+  e0:	43                   	inc    ebx
+
+The segment from ad to ba is especially bad, constants being spilled
+into the stack and then later loaded into registers.
+
+-O=all gets it to about 0m2.674s (vs 0m4.191s) for me (you have to
+write k to the console, otherwise it *really* eliminates dead code :-)
+
+Changing stuff to uint also got much better performance. 


More information about the mono-bugs mailing list