diff options
author | scoder <none@none> | 2008-07-18 10:08:11 +0200 |
---|---|---|
committer | scoder <none@none> | 2008-07-18 10:08:11 +0200 |
commit | a110a15cd9df3ea2b23eba529defe7bcfefcd238 (patch) | |
tree | 4766e138965ceb0df89d4650e3613b42936efefd /benchmark/bench_xpath.py | |
parent | 8fa6dc2d0b5870f7abcbfd82a36599d1bef7e9ec (diff) | |
download | python-lxml-a110a15cd9df3ea2b23eba529defe7bcfefcd238.tar.gz |
[svn r3901] r4639@delle: sbehnel | 2008-07-18 09:23:35 +0200
new benchmarks to compare multiple .iter(tag) loops to an or-ed XPath expression
--HG--
branch : trunk
Diffstat (limited to 'benchmark/bench_xpath.py')
-rw-r--r-- | benchmark/bench_xpath.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/benchmark/bench_xpath.py b/benchmark/bench_xpath.py index 93b19ec8..e48df56b 100644 --- a/benchmark/bench_xpath.py +++ b/benchmark/bench_xpath.py @@ -3,7 +3,7 @@ from itertools import * from StringIO import StringIO import benchbase -from benchbase import with_attributes, with_text, onlylib, serialized, children +from benchbase import with_attributes, with_text, onlylib, serialized, children, nochange ############################################################ # Benchmarks @@ -43,6 +43,24 @@ class XPathBenchMark(benchbase.TreeBenchMark): @nochange @onlylib('lxe') @children + def bench_multiple_xpath_or(self, children): + xpath = self.etree.XPath(".//p:a00001|.//p:b00001|.//p:c00001", + namespaces={'p':'cdefg'}) + for child in children: + xpath(child) + + @nochange + @onlylib('lxe') + @children + def bench_multiple_iter_tag(self, children): + for child in children: + list(child.iter("{cdefg}a00001")) + list(child.iter("{cdefg}b00001")) + list(child.iter("{cdefg}c00001")) + + @nochange + @onlylib('lxe') + @children def bench_xpath_old_extensions(self, children): def return_child(_, elements): if elements: |