[Lxml-checkins] r33748 - in lxml/branch/lxml-1.1: . benchmark

scoder at codespeak.net scoder at codespeak.net
Thu Oct 26 09:08:23 CEST 2006


Author: scoder
Date: Thu Oct 26 09:08:20 2006
New Revision: 33748

Added:
   lxml/branch/lxml-1.1/benchmark/bench_objectify.py
      - copied unchanged from r33747, lxml/trunk/benchmark/bench_objectify.py
Modified:
   lxml/branch/lxml-1.1/MANIFEST.in
   lxml/branch/lxml-1.1/benchmark/benchbase.py
Log:
merges from trunk: Pyrex in source distro, objectify benchmarks

Modified: lxml/branch/lxml-1.1/MANIFEST.in
==============================================================================
--- lxml/branch/lxml-1.1/MANIFEST.in	(original)
+++ lxml/branch/lxml-1.1/MANIFEST.in	Thu Oct 26 09:08:20 2006
@@ -8,5 +8,6 @@
 recursive-include src/lxml/tests *.rng *.xslt *.xml *.dtd
 recursive-include benchmark *.py
 recursive-include doc *.txt *.html *.css *.xml *.mgp pubkey.asc
+recursive-include pyrex/Pyrex *.py
 include doc/mkhtml.py doc/rest2html.py
 exclude doc/pyrex.txt src/lxml/etree.pxi

Modified: lxml/branch/lxml-1.1/benchmark/benchbase.py
==============================================================================
--- lxml/branch/lxml-1.1/benchmark/benchbase.py	(original)
+++ lxml/branch/lxml-1.1/benchmark/benchbase.py	Thu Oct 26 09:08:20 2006
@@ -96,7 +96,7 @@
 
     SEARCH_TAG = "{cdefg}a00001"
 
-    def __init__(self, etree):
+    def __init__(self, etree, etree_parser=None):
         self.etree = etree
         libname = etree.__name__.split('.')[-1]
         self.lib_name = self._LIB_NAME_MAP.get(libname, libname)
@@ -104,8 +104,8 @@
         if libname == 'etree':
             deepcopy = copy.deepcopy
             def set_property(root, fname):
-                setattr(self, fname, lambda : deepcopy(root))
                 xml = self._serialize_tree(root)
+                setattr(self, fname, lambda : etree.XML(xml, etree_parser))
                 setattr(self, fname + '_xml', lambda : xml)
         else:
             def set_property(root, fname):
@@ -184,7 +184,7 @@
         t = current_time()
         root = self.etree.Element('{abc}rootnode')
         for ch1 in atoz:
-            el = SubElement(root, "{bcd}"+ch1*5, attributes)
+            el = SubElement(root, "{abc}"+ch1*5, attributes)
             el.text = text
             for ch2 in atoz:
                 for i in range(20 * TREE_FACTOR):
@@ -201,7 +201,7 @@
         root = self.etree.Element('{abc}rootnode')
         for ch1 in atoz:
             for i in range(20 * TREE_FACTOR):
-                el = SubElement(root, "{bcd}"+ch1*5, attributes)
+                el = SubElement(root, "{abc}"+ch1*5, attributes)
                 el.text = text
                 for ch2 in atoz:
                     SubElement(el, "{cdefg}%s%05d" % (ch2, i))
@@ -232,10 +232,10 @@
         root = self.etree.Element('{abc}rootnode')
         children = [root]
         for ch1 in self.atoz:
-            el = SubElement(root, "{bcd}"+ch1*5, attributes)
+            el = SubElement(root, "{abc}"+ch1*5, attributes)
             el.text = text
             SubElement(el, "{cdefg}a00001", attributes)
-            SubElement(el, "{cdefg}a00002", attributes)
+            SubElement(el, "{cdefg}z00000", attributes)
         t = current_time() - t
         return (root, t)
 


More information about the lxml-checkins mailing list