[Mono-bugs] [Bug 76674][Maj] New - extremely poor performance and huge amount of memory consumption in case of extreme zooming

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Nov 11 13:43:14 EST 2005


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 michael.paul at tao.es.

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

--- shadow/76674	2005-11-11 13:43:14.000000000 -0500
+++ shadow/76674.tmp.13795	2005-11-11 13:43:14.000000000 -0500
@@ -0,0 +1,492 @@
+Bug#: 76674
+Product: Mono: Class Libraries
+Version: 1.1
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: libgdiplus
+AssignedTo: jordi at ximian.com                            
+ReportedBy: michael.paul at tao.es               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: extremely poor performance and huge amount of memory consumption in case of extreme zooming
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+Hi, 
+I am one of the developers of the monoGIS project, a small project to build
+a web mapping suite compatible with OGC standards. The Appomattox project
+(http://forge.novell.com/modules/xfmod/project/?appomattox) is using our
+code as a base library. For Windows installations, everything is working
+fine. But for Linux installations (Red Had and Gentoo), there is an
+important performance hit under extreme situations. We have created a test
+class, which generates different results on Windows and Linux, both tests
+done with mono 1.1.9.2. As Mono's implementation of System.Drawing should
+be same in both cases, I submit this bug to libgdiplus component.
+The problem I submit occurs once a user does several zoom ins to a map
+(quite usual). From some point on, any drawing of the maps consumes a lot
+of time and memory in Linux, whereas the result in Windows is instantly.
+The points submitted represents an existing code of Mexico in screen
+coordinates. It is obvious that the we are passing extreme values for the
+screen coordinates (e.g. new PointF(-908.9982f,2954.654f)). But, this code
+behaves well on Windows and in Java I used more or less the same syntaxis
+without problems. As a work-around we applied a clip algorithm so that this
+state of Mexico is being clipped to the extents of the current screen. The
+performance hit disappears within drawing, but of course we introduce a
+huge overhead on our side (as polygon clipping is somewhat time consuming,
+even more in managed code).
+
+
+Steps to reproduce the problem:
+Please use the following code:
+using System;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Drawing.Imaging;
+using System.IO;
+
+namespace SHPTest
+{	
+	public class DrawTest
+	{		
+		
+		public static void TestCase()
+		{
+			Bitmap moBtMap = new Bitmap
+(600,600,System.Drawing.Imaging.PixelFormat.Format32bppArgb);
+			moBtMap.MakeTransparent (Color.White);
+			Graphics moGraphics = Graphics.FromImage (moBtMap);
+			moGraphics.Clear (Color.White);
+			Pen oPen = new Pen (Color.FromArgb(255, 150, 150, 100), (float)0.5);
+			oPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
+			Color fill = Color.FromArgb ((int) (255*1), Color.FromArgb (255, 200,
+200, 150));
+			
+			Brush oBrush = new SolidBrush(Color.FromArgb (255, 200, 200, 150));
+			
+			PointF[] pts = new PointF[130];
+			byte[] types = new byte[130];
+			pts[0] = new PointF(565.7589f,2258.187f);
+			types[0]= (byte)0;
+			
+			pts[1] = new PointF(384.5005f,2083.582f);
+			types[1]= (byte)1;
+			
+			pts[2] = new PointF(354.2916f,2087.445f);
+			types[2]= (byte)1;
+			
+			pts[3] = new PointF(294.9233f,1974.425f);
+			types[3]= (byte)1;
+			
+			pts[4] = new PointF(215.9464f,1948.737f);
+			types[4]= (byte)1;
+			
+			pts[5] = new PointF(237.1368f,1823.08f);
+			types[5]= (byte)1;
+			
+			pts[6] = new PointF(151.4412f,1786.393f);
+			types[6]= (byte)1;
+			
+			pts[7] = new PointF(150.5222f,1743.578f);
+			types[7]= (byte)1;
+			
+			pts[8] = new PointF(108.7942f,1690.689f);
+			types[8]= (byte)1;
+			
+			pts[9] = new PointF(72.99147f,1708.729f);
+			types[9]= (byte)1;
+			
+			pts[10] = new PointF(64.03827f,1598.042f);
+			types[10]= (byte)1;
+			
+			pts[11] = new PointF(38.63488f,1595.289f);
+			types[11]= (byte)1;
+			
+			pts[12] = new PointF(-43.50557f,1729.213f);
+			types[12]= (byte)1;
+			
+			pts[13] = new PointF(-164.8734f,1794.033f);
+			types[13]= (byte)1;
+			
+			pts[14] = new PointF(-212.1953f,2008.669f);
+			types[14]= (byte)1;
+			
+			pts[15] = new PointF(-302.8922f,2177.143f);
+			types[15]= (byte)1;
+			
+			pts[16] = new PointF(-307.4969f,2294.851f);
+			types[16]= (byte)1;
+			
+			pts[17] = new PointF(-234.9022f,2403.996f);
+			types[17]= (byte)1;
+			
+			pts[18] = new PointF(-253.5266f,2521.112f);
+			types[18]= (byte)1;
+			
+			pts[19] = new PointF(-167.6352f,2599.073f);
+			types[19]= (byte)1;
+			
+			pts[20] = new PointF(-199.23f,2780.688f);
+			types[20]= (byte)1;
+			
+			pts[21] = new PointF(-295.5861f,2848.26f);
+			types[21]= (byte)1;
+			
+			pts[22] = new PointF(-343.6963f,2839.39f);
+			types[22]= (byte)1;
+			
+			pts[23] = new PointF(-380.2222f,2887.699f);
+			types[23]= (byte)1;
+			
+			pts[24] = new PointF(-427.7449f,2863.55f);
+			types[24]= (byte)1;
+			
+			pts[25] = new PointF(-461.4437f,2994.709f);
+			types[25]= (byte)1;
+			
+			pts[26] = new PointF(-441.83f,3141.168f);
+			types[26]= (byte)1;
+			
+			pts[27] = new PointF(-762.3575f,2983.086f);
+			types[27]= (byte)1;
+			
+			pts[28] = new PointF(-801.1229f,2994.104f);
+			types[28]= (byte)1;
+			
+			pts[29] = new PointF(-830.3477f,2934.787f);
+			types[29]= (byte)1;
+			
+			pts[30] = new PointF(-890.1729f,2977.286f);
+			types[30]= (byte)1;
+			
+			pts[31] = new PointF(-908.9982f,2954.654f);
+			types[31]= (byte)1;
+			
+			pts[32] = new PointF(-900.7681f,2924.088f);
+			types[32]= (byte)1;
+			
+			pts[33] = new PointF(-867.6618f,2775.185f);
+			types[33]= (byte)1;
+			
+			pts[34] = new PointF(-887.9333f,2632.7f);
+			types[34]= (byte)1;
+			
+			pts[35] = new PointF(-833.1094f,2693.239f);
+			types[35]= (byte)1;
+			
+			pts[36] = new PointF(-743.5322f,2548.32f);
+			types[36]= (byte)1;
+			
+			pts[37] = new PointF(-740.439f,2395.445f);
+			types[37]= (byte)1;
+			
+			pts[38] = new PointF(-765.6466f,2336.436f);
+			types[38]= (byte)1;
+			
+			pts[39] = new PointF(-699.3035f,2267.643f);
+			types[39]= (byte)1;
+			
+			pts[40] = new PointF(-664.5553f,2173.773f);
+			types[40]= (byte)1;
+			
+			pts[41] = new PointF(-598.0114f,2119.652f);
+			types[41]= (byte)1;
+			
+			pts[42] = new PointF(-517.5179f,2127.599f);
+			types[42]= (byte)1;
+			
+			pts[43] = new PointF(-465.0641f,2001.031f);
+			types[43]= (byte)1;
+			
+			pts[44] = new PointF(-489.2172f,1937.729f);
+			types[44]= (byte)1;
+			
+			pts[45] = new PointF(-441.6995f,1785.469f);
+			types[45]= (byte)1;
+			
+			pts[46] = new PointF(-537.6589f,1761.618f);
+			types[46]= (byte)1;
+			
+			pts[47] = new PointF(-523.2424f,1694.661f);
+			types[47]= (byte)1;
+			
+			pts[48] = new PointF(-650.2693f,1543.623f);
+			types[48]= (byte)1;
+			
+			pts[49] = new PointF(-674.4274f,1620.98f);
+			types[49]= (byte)1;
+			
+			pts[50] = new PointF(-649.7421f,1739.912f);
+			types[50]= (byte)1;
+			
+			pts[51] = new PointF(-748.865f,1971.289f);
+			types[51]= (byte)1;
+			
+			pts[52] = new PointF(-825.2107f,2010.495f);
+			types[52]= (byte)1;
+			
+			pts[53] = new PointF(-854.3049f,1976.254f);
+			types[53]= (byte)1;
+			
+			pts[54] = new PointF(-866.4115f,1939.699f);
+			types[54]= (byte)1;
+			
+			pts[55] = new PointF(-809.8753f,1522.832f);
+			types[55]= (byte)1;
+			
+			pts[56] = new PointF(-838.7686f,1469.326f);
+			types[56]= (byte)1;
+			
+			pts[57] = new PointF(-893.0703f,1465.959f);
+			types[57]= (byte)1;
+			
+			pts[58] = new PointF(-976.7874f,1897.983f);
+			types[58]= (byte)1;
+			
+			pts[59] = new PointF(-986.8604f,1592.848f);
+			types[59]= (byte)1;
+			
+			pts[60] = new PointF(-953.7542f,1561.663f);
+			types[60]= (byte)1;
+			
+			pts[61] = new PointF(-978.2336f,1465.044f);
+			types[61]= (byte)1;
+			
+			pts[62] = new PointF(-912.2872f,1399.609f);
+			types[62]= (byte)1;
+			
+			pts[63] = new PointF(-932.9554f,1304.53f);
+			types[63]= (byte)1;
+			
+			pts[64] = new PointF(-1067.881f,1258.662f);
+			types[64]= (byte)1;
+			
+			pts[65] = new PointF(-1059.455f,1375.459f);
+			types[65]= (byte)1;
+			
+			pts[66] = new PointF(-1082.624f,1459.85f);
+			types[66]= (byte)1;
+			
+			pts[67] = new PointF(-1011.737f,1538.12f);
+			types[67]= (byte)1;
+			
+			pts[68] = new PointF(-1030.562f,1695.278f);
+			types[68]= (byte)1;
+			
+			pts[69] = new PointF(-1158.181f,1723.709f);
+			types[69]= (byte)1;
+			
+			pts[70] = new PointF(-1280.202f,1809.212f);
+			types[70]= (byte)1;
+			
+			pts[71] = new PointF(-1268.226f,1749.036f);
+			types[71]= (byte)1;
+			
+			pts[72] = new PointF(-1233.473f,1635.961f);
+			types[72]= (byte)1;
+			
+			pts[73] = new PointF(-1195.631f,930.5989f);
+			types[73]= (byte)1;
+			
+			pts[74] = new PointF(-1174.963f,842.5326f);
+			types[74]= (byte)1;
+			
+			pts[75] = new PointF(-1126.521f,784.1415f);
+			types[75]= (byte)1;
+			
+			pts[76] = new PointF(-1114.676f,507.1275f);
+			types[76]= (byte)1;
+			
+			pts[77] = new PointF(-1021.609f,368.9249f);
+			types[77]= (byte)1;
+			
+			pts[78] = new PointF(-1010.421f,313.5927f);
+			types[78]= (byte)1;
+			
+			pts[79] = new PointF(-937.0981f,257.026f);
+			types[79]= (byte)1;
+			
+			pts[80] = new PointF(-970.2043f,188.5409f);
+			types[80]= (byte)1;
+			
+			pts[81] = new PointF(-981.3971f,51.56016f);
+			types[81]= (byte)1;
+			
+			pts[82] = new PointF(-965.1377f,-181.4248f);
+			types[82]= (byte)1;
+			
+			pts[83] = new PointF(-800.3998f,-301.8873f);
+			types[83]= (byte)1;
+			
+			pts[84] = new PointF(-808.2333f,-404.3074f);
+			types[84]= (byte)1;
+			
+			pts[85] = new PointF(-581.1645f,-625.0633f);
+			types[85]= (byte)1;
+			
+			pts[86] = new PointF(-251.8796f,-578.5906f);
+			types[86]= (byte)1;
+			
+			pts[87] = new PointF(-230.885f,-606.1097f);
+			types[87]= (byte)1;
+			
+			pts[88] = new PointF(-84.97249f,-598.7681f);
+			types[88]= (byte)1;
+			
+			pts[89] = new PointF(-79.30832f,-1013.059f);
+			types[89]= (byte)1;
+			
+			pts[90] = new PointF(-185.868f,-1285.175f);
+			types[90]= (byte)1;
+			
+			pts[91] = new PointF(-185.1449f,-1331.645f);
+			types[91]= (byte)1;
+			
+			pts[92] = new PointF(83.78251f,-1372.922f);
+			types[92]= (byte)1;
+			
+			pts[93] = new PointF(360.0161f,-1231.36f);
+			types[93]= (byte)1;
+			
+			pts[94] = new PointF(419.9769f,-1098.056f);
+			types[94]= (byte)1;
+			
+			pts[95] = new PointF(525.8084f,-1045.476f);
+			types[95]= (byte)1;
+			
+			pts[96] = new PointF(509.7499f,-968.7233f);
+			types[96]= (byte)1;
+			
+			pts[97] = new PointF(529.695f,-931.4208f);
+			types[97]= (byte)1;
+			
+			pts[98] = new PointF(618.1524f,-939.0711f);
+			types[98]= (byte)1;
+			
+			pts[99] = new PointF(674.0961f,-1004.804f);
+			types[99]= (byte)1;
+			
+			pts[100] = new PointF(699.8962f,-958.0247f);
+			types[100]= (byte)1;
+			
+			pts[101] = new PointF(751.8227f,-992.8834f);
+			types[101]= (byte)1;
+			
+			pts[102] = new PointF(913.603f,-750.113f);
+			types[102]= (byte)1;
+			
+			pts[103] = new PointF(995.3467f,-762.9594f);
+			types[103]= (byte)1;
+			
+			pts[104] = new PointF(1027.137f,-717.3998f);
+			types[104]= (byte)1;
+			
+			pts[105] = new PointF(923.1436f,-539.7576f);
+			types[105]= (byte)1;
+			
+			pts[106] = new PointF(797.3018f,-225.7519f);
+			types[106]= (byte)1;
+			
+			pts[107] = new PointF(646.5184f,11.20725f);
+			types[107]= (byte)1;
+			
+			pts[108] = new PointF(460.1884f,235.9268f);
+			types[108]= (byte)1;
+			
+			pts[109] = new PointF(427.6747f,328.2634f);
+			types[109]= (byte)1;
+			
+			pts[110] = new PointF(338.429f,396.4525f);
+			types[110]= (byte)1;
+			
+			pts[111] = new PointF(215.2183f,588.4589f);
+			types[111]= (byte)1;
+			
+			pts[112] = new PointF(126.1684f,571.947f);
+			types[112]= (byte)1;
+			
+			pts[113] = new PointF(125.6411f,632.4858f);
+			types[113]= (byte)1;
+			
+			pts[114] = new PointF(68.3818f,760.2879f);
+			types[114]= (byte)1;
+			
+			pts[115] = new PointF(125.0486f,875.2562f);
+			types[115]= (byte)1;
+			
+			pts[116] = new PointF(91.81177f,997.2471f);
+			types[116]= (byte)1;
+			
+			pts[117] = new PointF(159.0788f,1208.516f);
+			types[117]= (byte)1;
+			
+			pts[118] = new PointF(199.4912f,1268.448f);
+			types[118]= (byte)1;
+			
+			pts[119] = new PointF(296.239f,1417.351f);
+			types[119]= (byte)1;
+			
+			pts[120] = new PointF(338.1026f,1557.603f);
+			types[120]= (byte)1;
+			
+			pts[121] = new PointF(445.0539f,1593.154f);
+			types[121]= (byte)1;
+			
+			pts[122] = new PointF(535.55f,1442.118f);
+			types[122]= (byte)1;
+			
+			pts[123] = new PointF(594.5869f,1419.486f);
+			types[123]= (byte)1;
+			
+			pts[124] = new PointF(664.4198f,1446.388f);
+			types[124]= (byte)1;
+			
+			pts[125] = new PointF(706.2784f,1511.218f);
+			types[125]= (byte)1;
+			
+			pts[126] = new PointF(714.5085f,1600.189f);
+			types[126]= (byte)1;
+			
+			pts[127] = new PointF(673.8952f,1665.009f);
+			types[127]= (byte)1;
+			
+			pts[128] = new PointF(694.9601f,2013.248f);
+			types[128]= (byte)1;
+			
+			pts[129] = new PointF(565.7589f,2258.187f);
+			types[129]= (byte)1;
+			
+			GraphicsPath oPath = new GraphicsPath(pts, types);
+			moGraphics.DrawPath(oPen, oPath);
+			moGraphics.FillPath(oBrush, oPath);
+			moBtMap.Save ("test.jpg");
+		}
+	}
+}
+
+
+Actual Results:
+time mono DrawTest.exe:
+real    0m7.857s
+user    0m1.664s
+sys     0m4.664s
+
+
+Expected Results:
+time mono DrawTest.exe (obtained applying the clipping work-around):
+real    0m0.763s
+user    0m0.696s
+sys     0m0.040s
+
+How often does this happen? 
+always
+
+Additional Information:
+apart of the timings (7s instead of 0.7s), the memory consumption is
+important, so that definitely seems to be a bug!


More information about the mono-bugs mailing list