summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2013-04-06 11:37:41 +0200
committerStefan Behnel <stefan_ml@behnel.de>2013-04-06 11:37:41 +0200
commit00565de6e01863013f15998b4be0a464440e4fea (patch)
tree042793ff42ac477dceeff9752442cb1c8404f561
parentc536168368fb97f25271647ad351977dc04383c2 (diff)
downloadpython-lxml-00565de6e01863013f15998b4be0a464440e4fea.tar.gz
optimise tree iteration a little more
-rw-r--r--src/lxml/lxml.etree.pyx4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lxml/lxml.etree.pyx b/src/lxml/lxml.etree.pyx
index 2c65c1c5..fc808a33 100644
--- a/src/lxml/lxml.etree.pyx
+++ b/src/lxml/lxml.etree.pyx
@@ -2544,7 +2544,7 @@ cdef class _MultiTagMatcher:
for item in tag:
self._storeTags(item, seen)
- cdef int cacheTags(self, _Document doc, bint force_into_dict=False) except -1:
+ cdef inline int cacheTags(self, _Document doc, bint force_into_dict=False) except -1:
"""
Look up the tag names in the doc dict to enable string pointer comparisons.
"""
@@ -2719,6 +2719,7 @@ cdef class ElementDepthFirstIterator:
self._next_node = _elementFactory(current_node._doc, c_node)
return current_node
+ @cython.final
cdef xmlNode* _nextNodeAnyTag(self, xmlNode* c_node):
cdef int node_types = self._matcher._node_types
if not node_types:
@@ -2729,6 +2730,7 @@ cdef class ElementDepthFirstIterator:
tree.END_FOR_EACH_ELEMENT_FROM(c_node)
return NULL
+ @cython.final
cdef xmlNode* _nextNodeMatchTag(self, xmlNode* c_node):
tree.BEGIN_FOR_EACH_ELEMENT_FROM(self._top_node._c_node, c_node, 0)
if self._matcher.matches(c_node):