From a110a15cd9df3ea2b23eba529defe7bcfefcd238 Mon Sep 17 00:00:00 2001 From: scoder Date: Fri, 18 Jul 2008 10:08:11 +0200 Subject: [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 --- benchmark/bench_xpath.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'benchmark') 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 @@ -40,6 +40,24 @@ class XPathBenchMark(benchbase.TreeBenchMark): for child in children: child.xpath("./*[0]") + @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 -- cgit v1.2.1