diff options
author | Ben Maurer <benm@mono-cvs.ximian.com> | 2003-09-13 22:38:53 +0400 |
---|---|---|
committer | Ben Maurer <benm@mono-cvs.ximian.com> | 2003-09-13 22:38:53 +0400 |
commit | b0d1119294918362f98face10bf37788dd8fe397 (patch) | |
tree | dcf503c583ad6f5e0dd47f4c65294f59585383f5 /mcs | |
parent | 42f2e5051bff00cb0ccce27051a5b28d775ab03e (diff) |
reduce enumerator allocation
svn path=/trunk/mcs/; revision=18064
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog | 4 | ||||
-rw-r--r-- | mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs | 18 |
2 files changed, 16 insertions, 6 deletions
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog index 147edf3ec3a..ef48dd62ee5 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog +++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog @@ -1,3 +1,7 @@ +2003-09-13 Ben Maurer <bmaurer@users.sourceforge.net> + + * XslLiteralElement.cs: reduce enumerator allocation. + 2003-08-30 Oleg Tkachenko <oleg@tkachenko.com> * XslAttribute.cs: output is now done to TextOutputter, which outputs diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs index d515a24c098..4b87ffcbee3 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs @@ -19,7 +19,7 @@ namespace Mono.Xml.Xsl.Operations { public class XslLiteralElement : XslCompiledElement { XslOperation children; string localname, prefix, nsUri; - ArrayList attrs = new ArrayList (); + ArrayList attrs; XmlQualifiedName [] useAttributeSets; Hashtable nsDecls; @@ -51,9 +51,11 @@ namespace Mono.Xml.Xsl.Operations { this.localname = c.Input.LocalName; this.useAttributeSets = c.ParseQNameListAttribute ("use-attribute-sets", XsltNamespace); this.nsDecls = c.GetNamespacesToCopy (); + if (nsDecls.Count == 0) nsDecls = null; if (c.Input.MoveToFirstAttribute ()) { + attrs = new ArrayList (); do { if (c.Input.NamespaceURI == XsltNamespace) continue; //already handled @@ -71,11 +73,15 @@ namespace Mono.Xml.Xsl.Operations { { p.Out.WriteStartElement (prefix, localname, nsUri); - foreach (DictionaryEntry de in nsDecls) - p.Out.WriteNamespaceDecl ((string)de.Key, (string)de.Value); - - foreach (XslLiteralAttribute a in attrs) - a.Evaluate (p); + if (nsDecls != null) + foreach (DictionaryEntry de in nsDecls) + p.Out.WriteNamespaceDecl ((string)de.Key, (string)de.Value); + + if (attrs != null) { + int len = attrs.Count; + for (int i = 0; i < len; i++) + ((XslLiteralAttribute)attrs [i]).Evaluate (p); + } if (useAttributeSets != null) foreach (XmlQualifiedName s in useAttributeSets) |