libxml2dom

Changeset

63:f042003c3cde
2005-01-24 paulb raw files shortlog changelog graph [project @ 2005-01-24 12:46:58 by paulb] Added the controversial "begat" benchmark.
tests/begat.py (file)
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tests/begat.py	Mon Jan 24 12:46:58 2005 +0000
     1.3 @@ -0,0 +1,25 @@
     1.4 +#!/usr/bin/env python
     1.5 +
     1.6 +import libxml2macro as n_
     1.7 +import time, os
     1.8 +
     1.9 +raw_input("Start your engines with ps -p %s -fv" % os.getpid())
    1.10 +t = time.time()
    1.11 +
    1.12 +l = []
    1.13 +n_doc = parseFile("ot.xml")
    1.14 +for n_node in n_doc.xpath("//v[contains(text(), 'begat')]"):
    1.15 +    text = n_node.nodeValue
    1.16 +    l.append(text)
    1.17 +
    1.18 +#for n_node in n_doc.xpath("//v"):
    1.19 +#    text = n_node.nodeValue
    1.20 +#    if text.find(u'begat') != -1:
    1.21 +#        print text
    1.22 +
    1.23 +print "Time taken", time.time() - t
    1.24 +raw_input("Stop your engines!")
    1.25 +
    1.26 +print l
    1.27 +
    1.28 +# vim: tabstop=4 expandtab shiftwidth=4