import sys, copy from itertools import * import benchbase from benchbase import with_attributes, with_text, onlylib, serialized ############################################################ # Benchmarks ############################################################ class XSLTBenchMark(benchbase.TreeBenchMark): @onlylib('lxe') def bench_xslt_extensions_old(self, root): tree = self.etree.XML("""\ TEST """) def return_child(_, elements): return elements[0][0] extensions = {('testns', 'child') : return_child} transform = self.etree.XSLT(tree, extensions) for i in range(10): transform(root) @onlylib('lxe') def bench_xslt_document(self, root): transform = self.etree.XSLT(self.etree.XML("""\ TEST """)) transform(root) if __name__ == '__main__': benchbase.main(XSLTBenchMark)