diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2007-02-01 11:58:19 +0300 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2007-02-01 11:58:19 +0300 |
commit | 74fc1575883448c53af0443aa6c2de8dd1a8ed1d (patch) | |
tree | 44bd8930c13ecde18ba9a067e6768f5c925a0411 /mcs/class/System.XML/Mono.Xml.XPath | |
parent | 06e85396783da44ea300d96b13bff08b2c7d5532 (diff) |
2007-01-31 Atsushi Enomoto <atsushi@ximian.com>
* DTMXPathNavigator2.cs : cosmetic performance improvement.
svn path=/trunk/mcs/; revision=72076
Diffstat (limited to 'mcs/class/System.XML/Mono.Xml.XPath')
-rw-r--r-- | mcs/class/System.XML/Mono.Xml.XPath/ChangeLog | 4 | ||||
-rw-r--r-- | mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs | 14 |
2 files changed, 11 insertions, 7 deletions
diff --git a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog index 808d0559073..c9f2b7ff967 100644 --- a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog +++ b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog @@ -1,3 +1,7 @@ +2007-01-31 Atsushi Enomoto <atsushi@ximian.com> + + * DTMXPathNavigator2.cs : cosmetic performance improvement. + 2007-01-05 Atsushi Enomoto <atsushi@ximian.com> * DTMXPathDocumentBuilder2.cs : fixed incorrect namespace node links diff --git a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs index 1981ed85a48..c10f3213a68 100644 --- a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs +++ b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs @@ -346,11 +346,14 @@ namespace Mono.Xml.XPath if (another == null || another.document != this.document) return false; - // Maybe we can improve here more efficiently by - // comparing node indices. if (another.currentNode == currentNode) return !another.currentIsNode; int tmp = nodes [another.currentNode].Parent; + + // ancestors must appear in prior on the node list. + if (tmp < currentNode) + return false; + while (tmp != 0) { if (tmp == currentNode) return true; @@ -415,11 +418,8 @@ namespace Mono.Xml.XPath if (cur == 0) return false; - int next = cur; - while (next != 0) { - cur = next; - next = nodes [cur].PreviousSibling; - } + cur = nodes [cur].Parent; + cur = nodes [cur].FirstChild; currentNode = cur; currentIsNode = true; return true; |