Use class instead of struct in HtmlTextWriter.cs under TARGET_JVM for better perf.
authorEyal Alalouf <eyala@mainsoft.com>
Mon, 25 Jul 2005 14:50:43 +0000 (14:50 -0000)
committerEyal Alalouf <eyala@mainsoft.com>
Mon, 25 Jul 2005 14:50:43 +0000 (14:50 -0000)
svn path=/trunk/mcs/; revision=47657

mcs/class/System.Web/System.Web.UI/ChangeLog
mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs

index e7b82ed1c6bc8d88ddb25fe80ce51ec01f865627..01a6650e0005e75b5ab89932fa4e53ae58430aa1 100644 (file)
@@ -1,3 +1,7 @@
+2005-07-25 Eyal Alaluf (eyala@mainsoft.com)
+       * HtmlTextWriter.cs: Make several structs into clases under TARGET_JVM.
+         (Perf issue with array of structs under TARGET_JVM).
+
 2005-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * TemplateParser.cs: if there are no commas in the assembly name, just
index 690adcd5ff8b3ee15e3347597024abae87ccad83..d4564901dd5c3b2a048cf74698436fc36d19c8cd 100644 (file)
@@ -305,7 +305,11 @@ private void AddAttribute(string name, string value, HtmlTextWriterAttribute key
                System.Array.Copy(_attrList, rAttrArr, (int) _attrList.Length);\r
                _attrList = rAttrArr;\r
        }\r
-       RenderAttribute rAttr;\r
+#if TARGET_JVM // RenderAttribute is a class and not a struct under TARGET_JVM
+       RenderAttribute rAttr = new RenderAttribute();\r
+#else
+       RenderAttribute rAttr;
+#endif
        rAttr.name = name;\r
        rAttr.value = value;\r
        rAttr.key = key;\r
@@ -327,7 +331,11 @@ protected virtual void AddStyleAttribute(string name, string value, HtmlTextWrit
                System.Array.Copy(_styleList, rAttrArr, (int) _styleList.Length);\r
                _styleList = rAttrArr;\r
        }\r
-       RenderStyle rAttr;\r
+#if TARGET_JVM // RenderStyle is a class and not a struct under TARGET_JVM
+       RenderStyle rAttr = new RenderStyle();\r
+#else
+       RenderStyle rAttr;
+#endif
        rAttr.name = name;\r
        rAttr.value = value;\r
        rAttr.key = key;\r
@@ -377,7 +385,7 @@ protected virtual void FilterAttributes(){
        }\r
        _styleCount = count;\r
        count = 0;\r
-       for(int i=0; i <= _attrCount; i++){\r
+       for(int i=0; i < _attrCount; i++){\r
                RenderAttribute rAttr = _attrList[i];\r
                if (OnAttributeRender(rAttr.name, rAttr.value, rAttr.key)) {\r
                        count++;\r
@@ -512,6 +520,9 @@ protected void PushEndTag(string endTag){
                System.Array.Copy(_endTags, temp, (int) _endTags.Length);\r
                _endTags = temp;\r
        }\r
+#if TARGET_JVM // TagStackEntry is a class and not a struct under TARGET_JVM
+       _endTags[_endTagCount] = new TagStackEntry();\r
+#endif
        _endTags[_endTagCount].tagKey = _tagKey;\r
        _endTags[_endTagCount].endTagText = endTag;\r
        _endTagCount++;\r
@@ -1069,14 +1080,22 @@ struct AttributeInformation {
        }\r
 } \r
  \r
+#if TARGET_JVM
+class RenderAttribute {\r
+#else
 struct RenderAttribute {\r
+#endif
        public bool encode;\r
        public HtmlTextWriterAttribute key;\r
        public string name;\r
        public string value;\r
 } \r
  \r
+#if TARGET_JVM
+class RenderStyle {\r
+#else
 struct RenderStyle {\r
+#endif
        public HtmlTextWriterStyle key;\r
        public string name;\r
        public string value;\r
@@ -1094,7 +1113,11 @@ struct TagInformation {
        }\r
 } \r
  \r
+#if TARGET_JVM
+class TagStackEntry {\r
+#else
 struct TagStackEntry {\r
+#endif
        public string endTagText;\r
        public HtmlTextWriterTag tagKey;\r
 } \r