[pypy-svn] r25616 - in pypy/dist/pypy/translator/microbench/pybench: . package
ale at codespeak.net
ale at codespeak.net
Sun Apr 9 13:26:16 CEST 2006
Author: ale
Date: Sun Apr 9 13:26:13 2006
New Revision: 25616
Added:
pypy/dist/pypy/translator/microbench/pybench/
pypy/dist/pypy/translator/microbench/pybench/Arithmetic.py
pypy/dist/pypy/translator/microbench/pybench/Calls.py
pypy/dist/pypy/translator/microbench/pybench/CommandLine.py
pypy/dist/pypy/translator/microbench/pybench/Constructs.py
pypy/dist/pypy/translator/microbench/pybench/Dict.py
pypy/dist/pypy/translator/microbench/pybench/Exceptions.py
pypy/dist/pypy/translator/microbench/pybench/Imports.py
pypy/dist/pypy/translator/microbench/pybench/Instances.py
pypy/dist/pypy/translator/microbench/pybench/Lists.py
pypy/dist/pypy/translator/microbench/pybench/Lookups.py
pypy/dist/pypy/translator/microbench/pybench/Numbers.py
pypy/dist/pypy/translator/microbench/pybench/README
pypy/dist/pypy/translator/microbench/pybench/Setup.py
pypy/dist/pypy/translator/microbench/pybench/Strings.py
pypy/dist/pypy/translator/microbench/pybench/Tuples.py
pypy/dist/pypy/translator/microbench/pybench/Unicode.py
pypy/dist/pypy/translator/microbench/pybench/package/
pypy/dist/pypy/translator/microbench/pybench/package/__init__.py
pypy/dist/pypy/translator/microbench/pybench/package/submodule.py
pypy/dist/pypy/translator/microbench/pybench/platform.py (contents, props changed)
pypy/dist/pypy/translator/microbench/pybench/pybench.py (contents, props changed)
pypy/dist/pypy/translator/microbench/pybench/python2.4.2.bench
Log:
Added pybench benchmarking. It doesn't contain a license file, but I have retained the original README file which mentions the original author : Marc-Andre Lemburg
Added: pypy/dist/pypy/translator/microbench/pybench/Arithmetic.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/microbench/pybench/Arithmetic.py Sun Apr 9 13:26:13 2006
@@ -0,0 +1,778 @@
+from pybench import Test
+
+class SimpleIntegerArithmetic(Test):
+
+ version = 0.3
+ operations = 5 * (3 + 5 + 5 + 3 + 3 + 3)
+ rounds = 120000
+
+ def test(self):
+
+ for i in xrange(self.rounds):
+
+ a = 2
+ b = 3
+ c = 3
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2
+ b = 3
+ c = 3
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2
+ b = 3
+ c = 3
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2
+ b = 3
+ c = 3
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2
+ b = 3
+ c = 3
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ def calibrate(self):
+
+ for i in xrange(self.rounds):
+ pass
+
+class SimpleFloatArithmetic(Test):
+
+ version = 0.3
+ operations = 5 * (3 + 5 + 5 + 3 + 3 + 3)
+ rounds = 100000
+
+ def test(self):
+
+ for i in xrange(self.rounds):
+
+ a = 2.1
+ b = 3.3332
+ c = 3.14159
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2.1
+ b = 3.3332
+ c = 3.14159
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2.1
+ b = 3.3332
+ c = 3.14159
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2.1
+ b = 3.3332
+ c = 3.14159
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2.1
+ b = 3.3332
+ c = 3.14159
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ def calibrate(self):
+
+ for i in xrange(self.rounds):
+ pass
+
+class SimpleIntFloatArithmetic(Test):
+
+ version = 0.3
+ operations = 5 * (3 + 5 + 5 + 3 + 3 + 3)
+ rounds = 120000
+
+ def test(self):
+
+ for i in xrange(self.rounds):
+
+ a = 2
+ b = 3
+ c = 3.14159
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2
+ b = 3
+ c = 3.14159
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2
+ b = 3
+ c = 3.14159
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2
+ b = 3
+ c = 3.14159
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2
+ b = 3
+ c = 3.14159
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ def calibrate(self):
+
+ for i in xrange(self.rounds):
+ pass
+
+
+class SimpleLongArithmetic(Test):
+
+ version = 0.3
+ operations = 5 * (3 + 5 + 5 + 3 + 3 + 3)
+ rounds = 30000
+
+ def test(self):
+
+ for i in xrange(self.rounds):
+
+ a = 2220001L
+ b = 100001L
+ c = 30005L
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2220001L
+ b = 100001L
+ c = 30005L
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2220001L
+ b = 100001L
+ c = 30005L
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2220001L
+ b = 100001L
+ c = 30005L
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2220001L
+ b = 100001L
+ c = 30005L
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ def calibrate(self):
+
+ for i in xrange(self.rounds):
+ pass
+
+class SimpleComplexArithmetic(Test):
+
+ version = 0.3
+ operations = 5 * (3 + 5 + 5 + 3 + 3 + 3)
+ rounds = 40000
+
+ def test(self):
+
+ for i in xrange(self.rounds):
+
+ a = 2 + 3j
+ b = 2.5 + 4.5j
+ c = 1.2 + 6.2j
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2 + 3j
+ b = 2.5 + 4.5j
+ c = 1.2 + 6.2j
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2 + 3j
+ b = 2.5 + 4.5j
+ c = 1.2 + 6.2j
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2 + 3j
+ b = 2.5 + 4.5j
+ c = 1.2 + 6.2j
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ a = 2 + 3j
+ b = 2.5 + 4.5j
+ c = 1.2 + 6.2j
+
+ c = a + b
+ c = b + c
+ c = c + a
+ c = a + b
+ c = b + c
+
+ c = c - a
+ c = a - b
+ c = b - c
+ c = c - a
+ c = b - c
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ c = a * b
+ c = b * a
+ c = c * b
+
+ c = a / b
+ c = b / a
+ c = c / b
+
+ def calibrate(self):
+
+ for i in xrange(self.rounds):
+ pass
+
Added: pypy/dist/pypy/translator/microbench/pybench/Calls.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/microbench/pybench/Calls.py Sun Apr 9 13:26:13 2006
@@ -0,0 +1,410 @@
+from pybench import Test
+
+class PythonFunctionCalls(Test):
+
+ version = 0.3
+ operations = 5*(1+4+4+2)
+ rounds = 60000
+
+ def test(self):
+
+ global f,f1,g,h
+
+ # define functions
+ def f():
+ pass
+
+ def f1(x):
+ pass
+
+ def g(a,b,c):
+ return a,b,c
+
+ def h(a,b,c,d=1,e=2,f=3):
+ return d,e,f
+
+ # do calls
+ for i in xrange(self.rounds):
+
+ f()
+ f1(i)
+ f1(i)
+ f1(i)
+ f1(i)
+ g(i,i,i)
+ g(i,i,i)
+ g(i,i,i)
+ g(i,i,i)
+ h(i,i,3,i,i)
+ h(i,i,i,2,i,3)
+
+ f()
+ f1(i)
+ f1(i)
+ f1(i)
+ f1(i)
+ g(i,i,i)
+ g(i,i,i)
+ g(i,i,i)
+ g(i,i,i)
+ h(i,i,3,i,i)
+ h(i,i,i,2,i,3)
+
+ f()
+ f1(i)
+ f1(i)
+ f1(i)
+ f1(i)
+ g(i,i,i)
+ g(i,i,i)
+ g(i,i,i)
+ g(i,i,i)
+ h(i,i,3,i,i)
+ h(i,i,i,2,i,3)
+
+ f()
+ f1(i)
+ f1(i)
+ f1(i)
+ f1(i)
+ g(i,i,i)
+ g(i,i,i)
+ g(i,i,i)
+ g(i,i,i)
+ h(i,i,3,i,i)
+ h(i,i,i,2,i,3)
+
+ f()
+ f1(i)
+ f1(i)
+ f1(i)
+ f1(i)
+ g(i,i,i)
+ g(i,i,i)
+ g(i,i,i)
+ g(i,i,i)
+ h(i,i,3,i,i)
+ h(i,i,i,2,i,3)
+
+ def calibrate(self):
+
+ global f,f1,g,h
+
+ # define functions
+ def f():
+ pass
+
+ def f1(x):
+ pass
+
+ def g(a,b,c):
+ return a,b,c
+
+ def h(a,b,c,d=1,e=2,f=3):
+ return d,e,f
+
+ # do calls
+ for i in xrange(self.rounds):
+ pass
+
+###
+
+class BuiltinFunctionCalls(Test):
+
+ version = 0.4
+ operations = 5*(2+5+5+5)
+ rounds = 30000
+
+ def test(self):
+
+ # localize functions
+ f0 = globals
+ f1 = hash
+ f2 = cmp
+ f3 = range
+
+ # do calls
+ for i in xrange(self.rounds):
+
+ f0()
+ f0()
+ f1(i)
+ f1(i)
+ f1(i)
+ f1(i)
+ f1(i)
+ f2(1,2)
+ f2(1,2)
+ f2(1,2)
+ f2(1,2)
+ f2(1,2)
+ f3(1,3,2)
+ f3(1,3,2)
+ f3(1,3,2)
+ f3(1,3,2)
+ f3(1,3,2)
+
+ f0()
+ f0()
+ f1(i)
+ f1(i)
+ f1(i)
+ f1(i)
+ f1(i)
+ f2(1,2)
+ f2(1,2)
+ f2(1,2)
+ f2(1,2)
+ f2(1,2)
+ f3(1,3,2)
+ f3(1,3,2)
+ f3(1,3,2)
+ f3(1,3,2)
+ f3(1,3,2)
+
+ f0()
+ f0()
+ f1(i)
+ f1(i)
+ f1(i)
+ f1(i)
+ f1(i)
+ f2(1,2)
+ f2(1,2)
+ f2(1,2)
+ f2(1,2)
+ f2(1,2)
+ f3(1,3,2)
+ f3(1,3,2)
+ f3(1,3,2)
+ f3(1,3,2)
+ f3(1,3,2)
+
+ f0()
+ f0()
+ f1(i)
+ f1(i)
+ f1(i)
+ f1(i)
+ f1(i)
+ f2(1,2)
+ f2(1,2)
+ f2(1,2)
+ f2(1,2)
+ f2(1,2)
+ f3(1,3,2)
+ f3(1,3,2)
+ f3(1,3,2)
+ f3(1,3,2)
+ f3(1,3,2)
+
+ f0()
+ f0()
+ f1(i)
+ f1(i)
+ f1(i)
+ f1(i)
+ f1(i)
+ f2(1,2)
+ f2(1,2)
+ f2(1,2)
+ f2(1,2)
+ f2(1,2)
+ f3(1,3,2)
+ f3(1,3,2)
+ f3(1,3,2)
+ f3(1,3,2)
+ f3(1,3,2)
+
+ def calibrate(self):
+
+ # localize functions
+ f0 = dir
+ f1 = hash
+ f2 = range
+ f3 = range
+
+ # do calls
+ for i in xrange(self.rounds):
+ pass
+
+###
+
+class PythonMethodCalls(Test):
+
+ version = 0.3
+ operations = 5*(6 + 5 + 4)
+ rounds = 20000
+
+ def test(self):
+
+ class c:
+
+ x = 2
+ s = 'string'
+
+ def f(self):
+
+ return self.x
+
+ def j(self,a,b):
+
+ self.y = a
+ self.t = b
+ return self.y
+
+ def k(self,a,b,c=3):
+
+ self.y = a
+ self.s = b
+ self.t = c
+
+ o = c()
+
+ for i in xrange(self.rounds):
+
+ o.f()
+ o.f()
+ o.f()
+ o.f()
+ o.f()
+ o.f()
+ o.j(i,i)
+ o.j(i,i)
+ o.j(i,2)
+ o.j(i,2)
+ o.j(2,2)
+ o.k(i,i)
+ o.k(i,2)
+ o.k(i,2,3)
+ o.k(i,i,c=4)
+
+ o.f()
+ o.f()
+ o.f()
+ o.f()
+ o.f()
+ o.f()
+ o.j(i,i)
+ o.j(i,i)
+ o.j(i,2)
+ o.j(i,2)
+ o.j(2,2)
+ o.k(i,i)
+ o.k(i,2)
+ o.k(i,2,3)
+ o.k(i,i,c=4)
+
+ o.f()
+ o.f()
+ o.f()
+ o.f()
+ o.f()
+ o.f()
+ o.j(i,i)
+ o.j(i,i)
+ o.j(i,2)
+ o.j(i,2)
+ o.j(2,2)
+ o.k(i,i)
+ o.k(i,2)
+ o.k(i,2,3)
+ o.k(i,i,c=4)
+
+ o.f()
+ o.f()
+ o.f()
+ o.f()
+ o.f()
+ o.f()
+ o.j(i,i)
+ o.j(i,i)
+ o.j(i,2)
+ o.j(i,2)
+ o.j(2,2)
+ o.k(i,i)
+ o.k(i,2)
+ o.k(i,2,3)
+ o.k(i,i,c=4)
+
+ o.f()
+ o.f()
+ o.f()
+ o.f()
+ o.f()
+ o.f()
+ o.j(i,i)
+ o.j(i,i)
+ o.j(i,2)
+ o.j(i,2)
+ o.j(2,2)
+ o.k(i,i)
+ o.k(i,2)
+ o.k(i,2,3)
+ o.k(i,i,c=4)
+
+ def calibrate(self):
+
+ class c:
+
+ x = 2
+ s = 'string'
+
+ def f(self):
+
+ return self.x
+
+ def j(self,a,b):
+
+ self.y = a
+ self.t = b
+
+ def k(self,a,b,c=3):
+
+ self.y = a
+ self.s = b
+ self.t = c
+
+ o = c
+
+ for i in xrange(self.rounds):
+ pass
+
+###
+
+class Recursion(Test):
+
+ version = 0.3
+ operations = 5
+ rounds = 50000
+
+ def test(self):
+
+ global f
+
+ def f(x):
+
+ if x > 1:
+ return f(x-1)
+ return 1
+
+ for i in xrange(self.rounds):
+ f(10)
+ f(10)
+ f(10)
+ f(10)
+ f(10)
+
+ def calibrate(self):
+
+ global f
+
+ def f(x):
+
+ if x > 0:
+ return f(x-1)
+ return 1
+
+ for i in xrange(self.rounds):
+ pass
+
Added: pypy/dist/pypy/translator/microbench/pybench/CommandLine.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/microbench/pybench/CommandLine.py Sun Apr 9 13:26:13 2006
@@ -0,0 +1,573 @@
+""" CommandLine - Get and parse command line options
+
+ NOTE: This still is very much work in progress !!!
+
+ Different version are likely to be incompatible.
+
+ TODO:
+
+ · Incorporate the changes made by (see Inbox)
+ · Add number range option using srange()
+
+ Copyright (c) 1997-2001, Marc-Andre Lemburg; mailto:mal at lemburg.com
+ Copyright (c) 2000-2001, eGenix.com Software GmbH; mailto:info at egenix.com
+ See the documentation for further information on copyrights,
+ or contact the author. All Rights Reserved.
+"""
+
+__version__ = '1.0'
+
+import sys,getopt,string,glob,os,traceback,re
+
+### Helpers
+
+def _getopt_flags(options):
+
+ """ Convert the option list to a getopt flag string and long opt
+ list
+
+ """
+ s = []
+ l = []
+ for o in options:
+ if o.prefix == '-':
+ # short option
+ s.append(o.name)
+ if o.takes_argument:
+ s.append(':')
+ else:
+ # long option
+ if o.takes_argument:
+ l.append(o.name+'=')
+ else:
+ l.append(o.name)
+ return string.join(s,''),l
+
+def invisible_input(prompt='>>> '):
+
+ """ Get raw input from a terminal without echoing the characters to
+ the terminal, e.g. for password queries.
+
+ """
+ import getpass
+ entry = getpass.getpass(prompt)
+ if entry is None:
+ raise KeyboardInterrupt
+ return entry
+
+def option_dict(options):
+
+ """ Return a dictionary mapping option names to Option instances.
+ """
+ d = {}
+ for option in options:
+ d[option.name] = option
+ return d
+
+# Alias
+getpasswd = invisible_input
+
+_integerRE = re.compile('\s*(-?\d+)\s*$')
+_integerRangeRE = re.compile('\s*(-?\d+)\s*-\s*(-?\d+)\s*$')
+
+def srange(s,
+
+ split=string.split,integer=_integerRE,
+ integerRange=_integerRangeRE):
+
+ """ Converts a textual representation of integer numbers and ranges
+ to a Python list.
+
+ Supported formats: 2,3,4,2-10,-1 - -3, 5 - -2
+
+ Values are appended to the created list in the order specified
+ in the string.
+
+ """
+ l = []
+ append = l.append
+ for entry in split(s,','):
+ m = integer.match(entry)
+ if m:
+ append(int(m.groups()[0]))
+ continue
+ m = integerRange.match(entry)
+ if m:
+ start,end = map(int,m.groups())
+ l[len(l):] = range(start,end+1)
+ return l
+
+### Option classes
+
+class Option:
+
+ """ Option base class. Takes no argument.
+
+ """
+ default = None
+ helptext = ''
+ prefix = '-'
+ takes_argument = 0
+ has_default = 0
+ tab = 15
+
+ def __init__(self,name,help=None):
+
+ if not name[:1] == '-':
+ raise TypeError,'option names must start with "-"'
+ if name[1:2] == '-':
+ self.prefix = '--'
+ self.name = name[2:]
+ else:
+ self.name = name[1:]
+ if help:
+ self.help = help
+
+ def __str__(self):
+
+ o = self
+ name = o.prefix + o.name
+ if o.takes_argument:
+ name = name + ' arg'
+ if len(name) > self.tab:
+ name = name + '\n' + ' ' * (self.tab + 1 + len(o.prefix))
+ else:
+ name = '%-*s ' % (self.tab, name)
+ description = o.help
+ if o.has_default:
+ description = description + ' (%s)' % o.default
+ return '%s %s' % (name, description)
+
+class ArgumentOption(Option):
+
+ """ Option that takes an argument.
+
+ An optional default argument can be given.
+
+ """
+ def __init__(self,name,help=None,default=None):
+
+ # Basemethod
+ Option.__init__(self,name,help)
+
+ if default is not None:
+ self.default = default
+ self.has_default = 1
+ self.takes_argument = 1
+
+class SwitchOption(Option):
+
+ """ Options that can be on or off. Has an optional default value.
+
+ """
+ def __init__(self,name,help=None,default=None):
+
+ # Basemethod
+ Option.__init__(self,name,help)
+
+ if default is not None:
+ self.default = default
+ self.has_default = 1
+
+### Application baseclass
+
+class Application:
+
+ """ Command line application interface with builtin argument
+ parsing.
+
+ """
+ # Options the program accepts (Option instances)
+ options = []
+
+ # Standard settings; these are appended to options in __init__
+ preset_options = [SwitchOption('-v','generate verbose output'),
+ SwitchOption('-h','show this help text'),
+ SwitchOption('--help','show this help text'),
+ SwitchOption('--debug','enable debugging'),
+ SwitchOption('--copyright','show copyright'),
+ SwitchOption('--examples','show examples of usage')]
+
+ # The help layout looks like this:
+ # [header] - defaults to ''
+ #
+ # [synopsis] - formatted as '<self.name> %s' % self.synopsis
+ #
+ # options:
+ # [options] - formatted from self.options
+ #
+ # [version] - formatted as 'Version:\n %s' % self.version, if given
+ #
+ # [about] - defaults to ''
+ #
+ # Note: all fields that do not behave as template are formatted
+ # using the instances dictionary as substitution namespace,
+ # e.g. %(name)s will be replaced by the applications name.
+ #
+
+ # Header (default to program name)
+ header = ''
+
+ # Name (defaults to program name)
+ name = ''
+
+ # Synopsis (%(name)s is replaced by the program name)
+ synopsis = '%(name)s [option] files...'
+
+ # Version (optional)
+ version = ''
+
+ # General information printed after the possible options (optional)
+ about = ''
+
+ # Examples of usage to show when the --examples option is given (optional)
+ examples = ''
+
+ # Copyright to show
+ copyright = (
+ 'Copyright (c) 1997-2001, Marc-Andre Lemburg; mailto:mal at lemburg.com\n'
+ 'Copyright (c) 2000-2001, eGenix.com Software GmbH; mailto:info at egenix.com\n'
+ 'See the documentation for further information on copyrights,\n'
+ 'or contact the author. All Rights Reserved.\n'
+ '*** UNAUTHORIZED COPYING, USAGE or DISTRIBUTION PROHIBITED. ***'
+ )
+
+ # Apply file globbing ?
+ globbing = 1
+
+ # Generate debug output ?
+ debug = 0
+
+ # Generate verbose output ?
+ verbose = 0
+
+ # Instance variables:
+ values = None # Dictionary of passed options (or default values)
+ # indexed by the options name, e.g. '-h'
+ files = None # List of passed filenames
+
+ def __init__(self,argv=None):
+
+ # Setup application specs
+ if argv is None:
+ argv = sys.argv
+ self.filename = os.path.split(argv[0])[1]
+ if not self.name:
+ self.name = os.path.split(self.filename)[1]
+ else:
+ self.name = self.name
+ if not self.header:
+ self.header = self.name
+ else:
+ self.header = self.header
+
+ # Init .arguments list
+ self.arguments = argv[1:]
+
+ # Setup Option mapping
+ self.option_map = option_dict(self.options)
+
+ # Append preset options
+ for option in self.preset_options:
+ if not self.option_map.has_key(option.name):
+ self.add_option(option)
+
+ # Init .files list
+ self.files = []
+
+ # Start Application
+ try:
+ # Process startup
+ rc = self.startup()
+ if rc is not None:
+ raise SystemExit,rc
+
+ # Parse command line
+ rc = self.parse()
+ if rc is not None:
+ raise SystemExit,rc
+
+ # Start application
+ rc = self.main()
+ if rc is None:
+ rc = 0
+
+ except SystemExit,rc:
+ pass
+
+ except KeyboardInterrupt:
+ print
+ print '* User Break'
+ rc = 1
+
+ except:
+ print
+ print '* Internal Error'
+ if self.debug:
+ print
+ traceback.print_exc(20)
+ rc = 1
+
+ raise SystemExit,rc
+
+ def add_option(self, option):
+
+ """ Add a new Option instance to the Application dynamically.
+
+ Note that this has to be done *before* .parse() is being
+ executed.
+
+ """
+ self.options.append(option)
+ self.option_map[option.name] = option
+
+ def startup(self):
+
+ """ Set user defined instance variables.
+
+ If this method returns anything other than None, the
+ process is terminated with the return value as exit code.
+
+ """
+ return None
+
+ def exit(self, rc=0):
+
+ """ Exit the program.
+
+ rc is used as exit code and passed back to the calling
+ program. It defaults to 0 which usually means: OK.
+
+ """
+ raise SystemExit, rc
+
+ def parse(self):
+
+ """ Parse the command line and fill in self.values and self.files.
+
+ After having parsed the options, the remaining command line
+ arguments are interpreted as files and passed to .handle_files()
+ for processing.
+
+ As final step the option handlers are called in the order
+ of the options given on the command line.
+
+ """
+ # Parse arguments
+ self.values = values = {}
+ for o in self.options:
+ if o.has_default:
+ values[o.prefix+o.name] = o.default
+ else:
+ values[o.prefix+o.name] = 0
+ flags,lflags = _getopt_flags(self.options)
+ try:
+ optlist,files = getopt.getopt(self.arguments,flags,lflags)
+ if self.globbing:
+ l = []
+ for f in files:
+ gf = glob.glob(f)
+ if not gf:
+ l.append(f)
+ else:
+ l[len(l):] = gf
+ files = l
+ self.optionlist = optlist
+ self.files = files + self.files
+ except getopt.error,why:
+ self.help(why)
+ sys.exit(1)
+
+ # Call file handler
+ rc = self.handle_files(self.files)
+ if rc is not None:
+ sys.exit(rc)
+
+ # Call option handlers
+ for optionname, value in optlist:
+
+ # Try to convert value to integer
+ try:
+ value = string.atoi(value)
+ except ValueError:
+ pass
+
+ # Find handler and call it (or count the number of option
+ # instances on the command line)
+ handlername = 'handle' + string.replace(optionname, '-', '_')
+ try:
+ handler = getattr(self, handlername)
+ except AttributeError:
+ if value == '':
+ # count the number of occurances
+ if values.has_key(optionname):
+ values[optionname] = values[optionname] + 1
+ else:
+ values[optionname] = 1
+ else:
+ values[optionname] = value
+ else:
+ rc = handler(value)
+ if rc is not None:
+ raise SystemExit, rc
+
+ # Apply final file check (for backward compatibility)
+ rc = self.check_files(self.files)
+ if rc is not None:
+ sys.exit(rc)
+
+ def check_files(self,filelist):
+
+ """ Apply some user defined checks on the files given in filelist.
+
+ This may modify filelist in place. A typical application
+ is checking that at least n files are given.
+
+ If this method returns anything other than None, the
+ process is terminated with the return value as exit code.
+
+ """
+ return None
+
+ def help(self,note=''):
+
+ self.print_header()
+ if self.synopsis:
+ print 'Synopsis:'
+ # To remain backward compatible:
+ try:
+ synopsis = self.synopsis % self.name
+ except (NameError, KeyError, TypeError):
+ synopsis = self.synopsis % self.__dict__
+ print ' ' + synopsis
+ print
+ self.print_options()
+ if self.version:
+ print 'Version:'
+ print ' %s' % self.version
+ print
+ if self.about:
+ print string.strip(self.about % self.__dict__)
+ print
+ if note:
+ print '-'*72
+ print 'Note:',note
+ print
+
+ def notice(self,note):
+
+ print '-'*72
+ print 'Note:',note
+ print '-'*72
+ print
+
+ def print_header(self):
+
+ print '-'*72
+ print self.header % self.__dict__
+ print '-'*72
+ print
+
+ def print_options(self):
+
+ options = self.options
+ print 'Options and default settings:'
+ if not options:
+ print ' None'
+ return
+ long = filter(lambda x: x.prefix == '--', options)
+ short = filter(lambda x: x.prefix == '-', options)
+ items = short + long
+ for o in options:
+ print ' ',o
+ print
+
+ #
+ # Example handlers:
+ #
+ # If a handler returns anything other than None, processing stops
+ # and the return value is passed to sys.exit() as argument.
+ #
+
+ # File handler
+ def handle_files(self,files):
+
+ """ This may process the files list in place.
+ """
+ return None
+
+ # Short option handler
+ def handle_h(self,arg):
+
+ self.help()
+ return 0
+
+ def handle_v(self, value):
+
+ """ Turn on verbose output.
+ """
+ self.verbose = 1
+
+ # Handlers for long options have two underscores in their name
+ def handle__help(self,arg):
+
+ self.help()
+ return 0
+
+ def handle__debug(self,arg):
+
+ self.debug = 1
+
+ def handle__copyright(self,arg):
+
+ self.print_header()
+ print string.strip(self.copyright % self.__dict__)
+ print
+ return 0
+
+ def handle__examples(self,arg):
+
+ self.print_header()
+ if self.examples:
+ print 'Examples:'
+ print
+ print string.strip(self.examples % self.__dict__)
+ print
+ else:
+ print 'No examples available.'
+ print
+ return 0
+
+ def main(self):
+
+ """ Override this method as program entry point.
+
+ The return value is passed to sys.exit() as argument. If
+ it is None, 0 is assumed (meaning OK). Unhandled
+ exceptions are reported with exit status code 1 (see
+ __init__ for further details).
+
+ """
+ return None
+
+# Alias
+CommandLine = Application
+
+def _test():
+
+ class MyApplication(Application):
+ header = 'Test Application'
+ version = __version__
+ options = [Option('-v','verbose')]
+
+ def handle_v(self,arg):
+ print 'VERBOSE, Yeah !'
+
+ cmd = MyApplication()
+ if not cmd.values['-h']:
+ cmd.help()
+ print 'files:',cmd.files
+ print 'Bye...'
+
+if __name__ == '__main__':
+ _test()
Added: pypy/dist/pypy/translator/microbench/pybench/Constructs.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/microbench/pybench/Constructs.py Sun Apr 9 13:26:13 2006
@@ -0,0 +1,565 @@
+from pybench import Test
+
+class IfThenElse(Test):
+
+ version = 0.31
+ operations = 30*3 # hard to say...
+ rounds = 150000
+
+ def test(self):
+
+ a,b,c = 1,2,3
+ for i in xrange(self.rounds):
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ if a == 1:
+ if b == 2:
+ if c != 3:
+ c = 3
+ b = 3
+ else:
+ c = 2
+ elif b == 3:
+ b = 2
+ a = 2
+ elif a == 2:
+ a = 3
+ else:
+ a = 1
+
+ def calibrate(self):
+
+ a,b,c = 1,2,3
+ for i in xrange(self.rounds):
+ pass
+
+class NestedForLoops(Test):
+
+ version = 0.3
+ operations = 1000*10*5
+ rounds = 150
+
+ def test(self):
+
+ l1 = range(1000)
+ l2 = range(10)
+ l3 = range(5)
+ for i in xrange(self.rounds):
+ for i in l1:
+ for j in l2:
+ for k in l3:
+ pass
+
+ def calibrate(self):
+
+ l1 = range(1000)
+ l2 = range(10)
+ l3 = range(5)
+ for i in xrange(self.rounds):
+ pass
+
+class ForLoops(Test):
+
+ version = 0.1
+ operations = 5 * 5
+ rounds = 8000
+
+ def test(self):
+
+ l1 = range(100)
+ for i in xrange(self.rounds):
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+ for i in l1:
+ pass
+
+ def calibrate(self):
+
+ l1 = range(1000)
+ for i in xrange(self.rounds):
+ pass
+
Added: pypy/dist/pypy/translator/microbench/pybench/Dict.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/microbench/pybench/Dict.py Sun Apr 9 13:26:13 2006
@@ -0,0 +1,503 @@
+from pybench import Test
+
+class DictCreation(Test):
+
+ version = 0.3
+ operations = 5*(5 + 5)
+ rounds = 60000
+
+ def test(self):
+
+ for i in xrange(self.rounds):
+
+ d1 = {}
+ d2 = {}
+ d3 = {}
+ d4 = {}
+ d5 = {}
+
+ d1 = {1:2,3:4,5:6}
+ d2 = {2:3,4:5,6:7}
+ d3 = {3:4,5:6,7:8}
+ d4 = {4:5,6:7,8:9}
+ d5 = {6:7,8:9,10:11}
+
+ d1 = {}
+ d2 = {}
+ d3 = {}
+ d4 = {}
+ d5 = {}
+
+ d1 = {1:2,3:4,5:6}
+ d2 = {2:3,4:5,6:7}
+ d3 = {3:4,5:6,7:8}
+ d4 = {4:5,6:7,8:9}
+ d5 = {6:7,8:9,10:11}
+
+ d1 = {}
+ d2 = {}
+ d3 = {}
+ d4 = {}
+ d5 = {}
+
+ d1 = {1:2,3:4,5:6}
+ d2 = {2:3,4:5,6:7}
+ d3 = {3:4,5:6,7:8}
+ d4 = {4:5,6:7,8:9}
+ d5 = {6:7,8:9,10:11}
+
+ d1 = {}
+ d2 = {}
+ d3 = {}
+ d4 = {}
+ d5 = {}
+
+ d1 = {1:2,3:4,5:6}
+ d2 = {2:3,4:5,6:7}
+ d3 = {3:4,5:6,7:8}
+ d4 = {4:5,6:7,8:9}
+ d5 = {6:7,8:9,10:11}
+
+ d1 = {}
+ d2 = {}
+ d3 = {}
+ d4 = {}
+ d5 = {}
+
+ d1 = {1:2,3:4,5:6}
+ d2 = {2:3,4:5,6:7}
+ d3 = {3:4,5:6,7:8}
+ d4 = {4:5,6:7,8:9}
+ d5 = {6:7,8:9,10:11}
+
+ def calibrate(self):
+
+ for i in xrange(self.rounds):
+ pass
+
+class DictWithStringKeys(Test):
+
+ version = 0.1
+ operations = 5*(6 + 6)
+ rounds = 200000
+
+ def test(self):
+
+ d = {}
+
+ for i in xrange(self.rounds):
+
+ d['abc'] = 1
+ d['def'] = 2
+ d['ghi'] = 3
+ d['jkl'] = 4
+ d['mno'] = 5
+ d['pqr'] = 6
+
+ d['abc']
+ d['def']
+ d['ghi']
+ d['jkl']
+ d['mno']
+ d['pqr']
+
+ d['abc'] = 1
+ d['def'] = 2
+ d['ghi'] = 3
+ d['jkl'] = 4
+ d['mno'] = 5
+ d['pqr'] = 6
+
+ d['abc']
+ d['def']
+ d['ghi']
+ d['jkl']
+ d['mno']
+ d['pqr']
+
+ d['abc'] = 1
+ d['def'] = 2
+ d['ghi'] = 3
+ d['jkl'] = 4
+ d['mno'] = 5
+ d['pqr'] = 6
+
+ d['abc']
+ d['def']
+ d['ghi']
+ d['jkl']
+ d['mno']
+ d['pqr']
+
+ d['abc'] = 1
+ d['def'] = 2
+ d['ghi'] = 3
+ d['jkl'] = 4
+ d['mno'] = 5
+ d['pqr'] = 6
+
+ d['abc']
+ d['def']
+ d['ghi']
+ d['jkl']
+ d['mno']
+ d['pqr']
+
+ d['abc'] = 1
+ d['def'] = 2
+ d['ghi'] = 3
+ d['jkl'] = 4
+ d['mno'] = 5
+ d['pqr'] = 6
+
+ d['abc']
+ d['def']
+ d['ghi']
+ d['jkl']
+ d['mno']
+ d['pqr']
+
+ def calibrate(self):
+
+ d = {}
+
+ for i in xrange(self.rounds):
+ pass
+
+class DictWithFloatKeys(Test):
+
+ version = 0.1
+ operations = 5*(6 + 6)
+ rounds = 200000
+
+ def test(self):
+
+ d = {}
+
+ for i in xrange(self.rounds):
+
+ d[1.234] = 1
+ d[2.345] = 2
+ d[3.456] = 3
+ d[4.567] = 4
+ d[5.678] = 5
+ d[6.789] = 6
+
+ d[1.234]
+ d[2.345]
+ d[3.456]
+ d[4.567]
+ d[5.678]
+ d[6.789]
+
+ d[1.234] = 1
+ d[2.345] = 2
+ d[3.456] = 3
+ d[4.567] = 4
+ d[5.678] = 5
+ d[6.789] = 6
+
+ d[1.234]
+ d[2.345]
+ d[3.456]
+ d[4.567]
+ d[5.678]
+ d[6.789]
+
+ d[1.234] = 1
+ d[2.345] = 2
+ d[3.456] = 3
+ d[4.567] = 4
+ d[5.678] = 5
+ d[6.789] = 6
+
+ d[1.234]
+ d[2.345]
+ d[3.456]
+ d[4.567]
+ d[5.678]
+ d[6.789]
+
+ d[1.234] = 1
+ d[2.345] = 2
+ d[3.456] = 3
+ d[4.567] = 4
+ d[5.678] = 5
+ d[6.789] = 6
+
+ d[1.234]
+ d[2.345]
+ d[3.456]
+ d[4.567]
+ d[5.678]
+ d[6.789]
+
+ d[1.234] = 1
+ d[2.345] = 2
+ d[3.456] = 3
+ d[4.567] = 4
+ d[5.678] = 5
+ d[6.789] = 6
+
+ d[1.234]
+ d[2.345]
+ d[3.456]
+ d[4.567]
+ d[5.678]
+ d[6.789]
+
+ def calibrate(self):
+
+ d = {}
+
+ for i in xrange(self.rounds):
+ pass
+
+class DictWithIntegerKeys(Test):
+
+ version = 0.1
+ operations = 5*(6 + 6)
+ rounds = 200000
+
+ def test(self):
+
+ d = {}
+
+ for i in xrange(self.rounds):
+
+ d[1] = 1
+ d[2] = 2
+ d[3] = 3
+ d[4] = 4
+ d[5] = 5
+ d[6] = 6
+
+ d[1]
+ d[2]
+ d[3]
+ d[4]
+ d[5]
+ d[6]
+
+ d[1] = 1
+ d[2] = 2
+ d[3] = 3
+ d[4] = 4
+ d[5] = 5
+ d[6] = 6
+
+ d[1]
+ d[2]
+ d[3]
+ d[4]
+ d[5]
+ d[6]
+
+ d[1] = 1
+ d[2] = 2
+ d[3] = 3
+ d[4] = 4
+ d[5] = 5
+ d[6] = 6
+
+ d[1]
+ d[2]
+ d[3]
+ d[4]
+ d[5]
+ d[6]
+
+ d[1] = 1
+ d[2] = 2
+ d[3] = 3
+ d[4] = 4
+ d[5] = 5
+ d[6] = 6
+
+ d[1]
+ d[2]
+ d[3]
+ d[4]
+ d[5]
+ d[6]
+
+ d[1] = 1
+ d[2] = 2
+ d[3] = 3
+ d[4] = 4
+ d[5] = 5
+ d[6] = 6
+
+ d[1]
+ d[2]
+ d[3]
+ d[4]
+ d[5]
+ d[6]
+
+ def calibrate(self):
+
+ d = {}
+
+ for i in xrange(self.rounds):
+ pass
+
+class SimpleDictManipulation(Test):
+
+ version = 0.3
+ operations = 5*(6 + 6 + 6 + 6)
+ rounds = 50000
+
+ def test(self):
+
+ d = {}
+
+ for i in xrange(self.rounds):
+
+ d[0] = 3
+ d[1] = 4
+ d[2] = 5
+ d[3] = 3
+ d[4] = 4
+ d[5] = 5
+
+ x = d[0]
+ x = d[1]
+ x = d[2]
+ x = d[3]
+ x = d[4]
+ x = d[5]
+
+ d.has_key(0)
+ d.has_key(2)
+ d.has_key(4)
+ d.has_key(6)
+ d.has_key(8)
+ d.has_key(10)
+
+ del d[0]
+ del d[1]
+ del d[2]
+ del d[3]
+ del d[4]
+ del d[5]
+
+ d[0] = 3
+ d[1] = 4
+ d[2] = 5
+ d[3] = 3
+ d[4] = 4
+ d[5] = 5
+
+ x = d[0]
+ x = d[1]
+ x = d[2]
+ x = d[3]
+ x = d[4]
+ x = d[5]
+
+ d.has_key(0)
+ d.has_key(2)
+ d.has_key(4)
+ d.has_key(6)
+ d.has_key(8)
+ d.has_key(10)
+
+ del d[0]
+ del d[1]
+ del d[2]
+ del d[3]
+ del d[4]
+ del d[5]
+
+ d[0] = 3
+ d[1] = 4
+ d[2] = 5
+ d[3] = 3
+ d[4] = 4
+ d[5] = 5
+
+ x = d[0]
+ x = d[1]
+ x = d[2]
+ x = d[3]
+ x = d[4]
+ x = d[5]
+
+ d.has_key(0)
+ d.has_key(2)
+ d.has_key(4)
+ d.has_key(6)
+ d.has_key(8)
+ d.has_key(10)
+
+ del d[0]
+ del d[1]
+ del d[2]
+ del d[3]
+ del d[4]
+ del d[5]
+
+ d[0] = 3
+ d[1] = 4
+ d[2] = 5
+ d[3] = 3
+ d[4] = 4
+ d[5] = 5
+
+ x = d[0]
+ x = d[1]
+ x = d[2]
+ x = d[3]
+ x = d[4]
+ x = d[5]
+
+ d.has_key(0)
+ d.has_key(2)
+ d.has_key(4)
+ d.has_key(6)
+ d.has_key(8)
+ d.has_key(10)
+
+ del d[0]
+ del d[1]
+ del d[2]
+ del d[3]
+ del d[4]
+ del d[5]
+
+ d[0] = 3
+ d[1] = 4
+ d[2] = 5
+ d[3] = 3
+ d[4] = 4
+ d[5] = 5
+
+ x = d[0]
+ x = d[1]
+ x = d[2]
+ x = d[3]
+ x = d[4]
+ x = d[5]
+
+ d.has_key(0)
+ d.has_key(2)
+ d.has_key(4)
+ d.has_key(6)
+ d.has_key(8)
+ d.has_key(10)
+
+ del d[0]
+ del d[1]
+ del d[2]
+ del d[3]
+ del d[4]
+ del d[5]
+
+ def calibrate(self):
+
+ d = {}
+
+ for i in xrange(self.rounds):
+ pass
+
Added: pypy/dist/pypy/translator/microbench/pybench/Exceptions.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/microbench/pybench/Exceptions.py Sun Apr 9 13:26:13 2006
@@ -0,0 +1,681 @@
+from pybench import Test
+
+class TryRaiseExcept(Test):
+
+ version = 0.1
+ operations = 2 + 3
+ rounds = 60000
+
+ def test(self):
+
+ error = ValueError
+
+ for i in xrange(self.rounds):
+ try:
+ raise error
+ except:
+ pass
+ try:
+ raise error
+ except:
+ pass
+ try:
+ raise error,"something"
+ except:
+ pass
+ try:
+ raise error,"something"
+ except:
+ pass
+ try:
+ raise error,"something"
+ except:
+ pass
+
+ def calibrate(self):
+
+ error = ValueError
+
+ for i in xrange(self.rounds):
+ pass
+
+
+class TryExcept(Test):
+
+ version = 0.1
+ operations = 15 * 10
+ rounds = 200000
+
+ def test(self):
+
+ for i in xrange(self.rounds):
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+
+
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+
+
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+
+
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+
+
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+
+
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+
+
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+
+
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+
+
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+
+
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+ try:
+ pass
+ except:
+ pass
+
+ def calibrate(self):
+
+ for i in xrange(self.rounds):
+ pass
+
+
Added: pypy/dist/pypy/translator/microbench/pybench/Imports.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/microbench/pybench/Imports.py Sun Apr 9 13:26:13 2006
@@ -0,0 +1,139 @@
+from pybench import Test
+
+# First imports:
+import os
+import package.submodule
+
+class SecondImport(Test):
+
+ version = 0.1
+ operations = 5 * 5
+ rounds = 20000
+
+ def test(self):
+
+ for i in xrange(self.rounds):
+ import os
+ import os
+ import os
+ import os
+ import os
+
+ import os
+ import os
+ import os
+ import os
+ import os
+
+ import os
+ import os
+ import os
+ import os
+ import os
+
+ import os
+ import os
+ import os
+ import os
+ import os
+
+ import os
+ import os
+ import os
+ import os
+ import os
+
+ def calibrate(self):
+
+ for i in xrange(self.rounds):
+ pass
+
+
+class SecondPackageImport(Test):
+
+ version = 0.1
+ operations = 5 * 5
+ rounds = 20000
+
+ def test(self):
+
+ for i in xrange(self.rounds):
+ import package
+ import package
+ import package
+ import package
+ import package
+
+ import package
+ import package
+ import package
+ import package
+ import package
+
+ import package
+ import package
+ import package
+ import package
+ import package
+
+ import package
+ import package
+ import package
+ import package
+ import package
+
+ import package
+ import package
+ import package
+ import package
+ import package
+
+ def calibrate(self):
+
+ for i in xrange(self.rounds):
+ pass
+
+class SecondSubmoduleImport(Test):
+
+ version = 0.1
+ operations = 5 * 5
+ rounds = 20000
+
+ def test(self):
+
+ for i in xrange(self.rounds):
+ import package.submodule
+ import package.submodule
+ import package.submodule
+ import package.submodule
+ import package.submodule
+
+ import package.submodule
+ import package.submodule
+ import package.submodule
+ import package.submodule
+ import package.submodule
+
+ import package.submodule
+ import package.submodule
+ import package.submodule
+ import package.submodule
+ import package.submodule
+
+ import package.submodule
+ import package.submodule
+ import package.submodule
+ import package.submodule
+ import package.submodule
+
+ import package.submodule
+ import package.submodule
+ import package.submodule
+ import package.submodule
+ import package.submodule
+
+ def calibrate(self):
+
+ for i in xrange(self.rounds):
+ pass
+
Added: pypy/dist/pypy/translator/microbench/pybench/Instances.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/microbench/pybench/Instances.py Sun Apr 9 13:26:13 2006
@@ -0,0 +1,68 @@
+from pybench import Test
+
+class CreateInstances(Test):
+
+ version = 0.2
+ operations = 3 + 7 + 4
+ rounds = 60000
+
+ def test(self):
+
+ class c:
+ pass
+
+ class d:
+ def __init__(self,a,b,c):
+ self.a = a
+ self.b = b
+ self.c = c
+
+ class e:
+ def __init__(self,a,b,c=4):
+ self.a = a
+ self.b = b
+ self.c = c
+ self.d = a
+ self.e = b
+ self.f = c
+
+ for i in xrange(self.rounds):
+ o = c()
+ o1 = c()
+ o2 = c()
+ p = d(i,i,3)
+ p1 = d(i,i,3)
+ p2 = d(i,3,3)
+ p3 = d(3,i,3)
+ p4 = d(i,i,i)
+ p5 = d(3,i,3)
+ p6 = d(i,i,i)
+ q = e(i,i,3)
+ q1 = e(i,i,3)
+ q2 = e(i,i,3)
+ q3 = e(i,i)
+
+ def calibrate(self):
+
+ class c:
+ pass
+
+ class d:
+ def __init__(self,a,b,c):
+ self.a = a
+ self.b = b
+ self.c = c
+
+ class e:
+ def __init__(self,a,b,c=4):
+ self.a = a
+ self.b = b
+ self.c = c
+ self.d = a
+ self.e = b
+ self.f = c
+
+ for i in xrange(self.rounds):
+ pass
+
+
Added: pypy/dist/pypy/translator/microbench/pybench/Lists.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/microbench/pybench/Lists.py Sun Apr 9 13:26:13 2006
@@ -0,0 +1,292 @@
+from pybench import Test
+
+class SimpleListManipulation(Test):
+
+ version = 0.2
+ operations = 5* (6 + 6 + 6)
+ rounds = 60000
+
+ def test(self):
+
+ l = []
+
+ for i in xrange(self.rounds):
+
+ l.append(2)
+ l.append(3)
+ l.append(4)
+ l.append(2)
+ l.append(3)
+ l.append(4)
+
+ l[0] = 3
+ l[1] = 4
+ l[2] = 5
+ l[3] = 3
+ l[4] = 4
+ l[5] = 5
+
+ x = l[0]
+ x = l[1]
+ x = l[2]
+ x = l[3]
+ x = l[4]
+ x = l[5]
+
+ l.append(2)
+ l.append(3)
+ l.append(4)
+ l.append(2)
+ l.append(3)
+ l.append(4)
+
+ l[0] = 3
+ l[1] = 4
+ l[2] = 5
+ l[3] = 3
+ l[4] = 4
+ l[5] = 5
+
+ x = l[0]
+ x = l[1]
+ x = l[2]
+ x = l[3]
+ x = l[4]
+ x = l[5]
+
+ l.append(2)
+ l.append(3)
+ l.append(4)
+ l.append(2)
+ l.append(3)
+ l.append(4)
+
+ l[0] = 3
+ l[1] = 4
+ l[2] = 5
+ l[3] = 3
+ l[4] = 4
+ l[5] = 5
+
+ x = l[0]
+ x = l[1]
+ x = l[2]
+ x = l[3]
+ x = l[4]
+ x = l[5]
+
+ l.append(2)
+ l.append(3)
+ l.append(4)
+ l.append(2)
+ l.append(3)
+ l.append(4)
+
+ l[0] = 3
+ l[1] = 4
+ l[2] = 5
+ l[3] = 3
+ l[4] = 4
+ l[5] = 5
+
+ x = l[0]
+ x = l[1]
+ x = l[2]
+ x = l[3]
+ x = l[4]
+ x = l[5]
+
+ l.append(2)
+ l.append(3)
+ l.append(4)
+ l.append(2)
+ l.append(3)
+ l.append(4)
+
+ l[0] = 3
+ l[1] = 4
+ l[2] = 5
+ l[3] = 3
+ l[4] = 4
+ l[5] = 5
+
+ x = l[0]
+ x = l[1]
+ x = l[2]
+ x = l[3]
+ x = l[4]
+ x = l[5]
+
+ if len(l) > 10000:
+ # cut down the size
+ l = []
+
+ def calibrate(self):
+
+ l = []
+
+ for i in xrange(self.rounds):
+ pass
+
+class ListSlicing(Test):
+
+ version = 0.4
+ operations = 25*(3+1+2+1)
+ rounds = 400
+
+ def test(self):
+
+ n = range(100)
+ r = range(25)
+
+ for i in xrange(self.rounds):
+
+ l = range(100)
+
+ for j in r:
+
+ m = l[50:]
+ m = l[:25]
+ m = l[50:55]
+ l[:3] = n
+ m = l[:-1]
+ m = l[1:]
+ l[-1:] = n
+
+ def calibrate(self):
+
+ n = range(100)
+ r = range(25)
+
+ for i in xrange(self.rounds):
+
+ l = range(100)
+
+ for j in r:
+ pass
+
+class SmallLists(Test):
+
+ version = 0.3
+ operations = 5*(1+ 6 + 6 + 3 + 1)
+ rounds = 60000
+
+ def test(self):
+
+ for i in xrange(self.rounds):
+
+ l = []
+
+ l.append(2)
+ l.append(3)
+ l.append(4)
+ l.append(2)
+ l.append(3)
+ l.append(4)
+
+ l[0] = 3
+ l[1] = 4
+ l[2] = 5
+ l[3] = 3
+ l[4] = 4
+ l[5] = 5
+
+ l[:3] = [1,2,3]
+ m = l[:-1]
+ m = l[1:]
+
+ l[-1:] = [4,5,6]
+
+ l = []
+
+ l.append(2)
+ l.append(3)
+ l.append(4)
+ l.append(2)
+ l.append(3)
+ l.append(4)
+
+ l[0] = 3
+ l[1] = 4
+ l[2] = 5
+ l[3] = 3
+ l[4] = 4
+ l[5] = 5
+
+ l[:3] = [1,2,3]
+ m = l[:-1]
+ m = l[1:]
+
+ l[-1:] = [4,5,6]
+
+ l = []
+
+ l.append(2)
+ l.append(3)
+ l.append(4)
+ l.append(2)
+ l.append(3)
+ l.append(4)
+
+ l[0] = 3
+ l[1] = 4
+ l[2] = 5
+ l[3] = 3
+ l[4] = 4
+ l[5] = 5
+
+ l[:3] = [1,2,3]
+ m = l[:-1]
+ m = l[1:]
+
+ l[-1:] = [4,5,6]
+
+ l = []
+
+ l.append(2)
+ l.append(3)
+ l.append(4)
+ l.append(2)
+ l.append(3)
+ l.append(4)
+
+ l[0] = 3
+ l[1] = 4
+ l[2] = 5
+ l[3] = 3
+ l[4] = 4
+ l[5] = 5
+
+ l[:3] = [1,2,3]
+ m = l[:-1]
+ m = l[1:]
+
+ l[-1:] = [4,5,6]
+
+ l = []
+
+ l.append(2)
+ l.append(3)
+ l.append(4)
+ l.append(2)
+ l.append(3)
+ l.append(4)
+
+ l[0] = 3
+ l[1] = 4
+ l[2] = 5
+ l[3] = 3
+ l[4] = 4
+ l[5] = 5
+
+ l[:3] = [1,2,3]
+ m = l[:-1]
+ m = l[1:]
+
+ l[-1:] = [4,5,6]
+
+ def calibrate(self):
+
+ for i in xrange(self.rounds):
+ l = []
+
Added: pypy/dist/pypy/translator/microbench/pybench/Lookups.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/microbench/pybench/Lookups.py Sun Apr 9 13:26:13 2006
@@ -0,0 +1,946 @@
+from pybench import Test
+
+class SpecialClassAttribute(Test):
+
+ version = 0.3
+ operations = 5*(12 + 12)
+ rounds = 100000
+
+ def test(self):
+
+ class c:
+ pass
+
+ for i in xrange(self.rounds):
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ c.__a = 2
+ c.__b = 3
+ c.__c = 4
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ x = c.__a
+ x = c.__b
+ x = c.__c
+
+ def calibrate(self):
+
+ class c:
+ pass
+
+ for i in xrange(self.rounds):
+ pass
+
+class NormalClassAttribute(Test):
+
+ version = 0.3
+ operations = 5*(12 + 12)
+ rounds = 100000
+
+ def test(self):
+
+ class c:
+ pass
+
+ for i in xrange(self.rounds):
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+ c.a = 2
+ c.b = 3
+ c.c = 4
+
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ x = c.a
+ x = c.b
+ x = c.c
+
+ def calibrate(self):
+
+ class c:
+ pass
+
+ for i in xrange(self.rounds):
+ pass
+
+class SpecialInstanceAttribute(Test):
+
+ version = 0.3
+ operations = 5*(12 + 12)
+ rounds = 100000
+
+ def test(self):
+
+ class c:
+ pass
+ o = c()
+
+ for i in xrange(self.rounds):
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+ o.__a__ = 2
+ o.__b__ = 3
+ o.__c__ = 4
+
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ x = o.__a__
+ x = o.__b__
+ x = o.__c__
+
+ def calibrate(self):
+
+ class c:
+ pass
+ o = c()
+
+ for i in xrange(self.rounds):
+ pass
+
+class NormalInstanceAttribute(Test):
+
+ version = 0.3
+ operations = 5*(12 + 12)
+ rounds = 100000
+
+ def test(self):
+
+ class c:
+ pass
+ o = c()
+
+ for i in xrange(self.rounds):
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+ o.a = 2
+ o.b = 3
+ o.c = 4
+
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ x = o.a
+ x = o.b
+ x = o.c
+
+ def calibrate(self):
+
+ class c:
+ pass
+ o = c()
+
+ for i in xrange(self.rounds):
+ pass
+
+class BuiltinMethodLookup(Test):
+
+ version = 0.3
+ operations = 5*(3*5 + 3*5)
+ rounds = 70000
+
+ def test(self):
+
+ l = []
+ d = {}
+
+ for i in xrange(self.rounds):
+
+ l.append
+ l.append
+ l.append
+ l.append
+ l.append
+
+ l.insert
+ l.insert
+ l.insert
+ l.insert
+ l.insert
+
+ l.sort
+ l.sort
+ l.sort
+ l.sort
+ l.sort
+
+ d.has_key
+ d.has_key
+ d.has_key
+ d.has_key
+ d.has_key
+
+ d.items
+ d.items
+ d.items
+ d.items
+ d.items
+
+ d.get
+ d.get
+ d.get
+ d.get
+ d.get
+
+ l.append
+ l.append
+ l.append
+ l.append
+ l.append
+
+ l.insert
+ l.insert
+ l.insert
+ l.insert
+ l.insert
+
+ l.sort
+ l.sort
+ l.sort
+ l.sort
+ l.sort
+
+ d.has_key
+ d.has_key
+ d.has_key
+ d.has_key
+ d.has_key
+
+ d.items
+ d.items
+ d.items
+ d.items
+ d.items
+
+ d.get
+ d.get
+ d.get
+ d.get
+ d.get
+
+ l.append
+ l.append
+ l.append
+ l.append
+ l.append
+
+ l.insert
+ l.insert
+ l.insert
+ l.insert
+ l.insert
+
+ l.sort
+ l.sort
+ l.sort
+ l.sort
+ l.sort
+
+ d.has_key
+ d.has_key
+ d.has_key
+ d.has_key
+ d.has_key
+
+ d.items
+ d.items
+ d.items
+ d.items
+ d.items
+
+ d.get
+ d.get
+ d.get
+ d.get
+ d.get
+
+ l.append
+ l.append
+ l.append
+ l.append
+ l.append
+
+ l.insert
+ l.insert
+ l.insert
+ l.insert
+ l.insert
+
+ l.sort
+ l.sort
+ l.sort
+ l.sort
+ l.sort
+
+ d.has_key
+ d.has_key
+ d.has_key
+ d.has_key
+ d.has_key
+
+ d.items
+ d.items
+ d.items
+ d.items
+ d.items
+
+ d.get
+ d.get
+ d.get
+ d.get
+ d.get
+
+ l.append
+ l.append
+ l.append
+ l.append
+ l.append
+
+ l.insert
+ l.insert
+ l.insert
+ l.insert
+ l.insert
+
+ l.sort
+ l.sort
+ l.sort
+ l.sort
+ l.sort
+
+ d.has_key
+ d.has_key
+ d.has_key
+ d.has_key
+ d.has_key
+
+ d.items
+ d.items
+ d.items
+ d.items
+ d.items
+
+ d.get
+ d.get
+ d.get
+ d.get
+ d.get
+
+ def calibrate(self):
+
+ l = []
+ d = {}
+
+ for i in xrange(self.rounds):
+ pass
+
Added: pypy/dist/pypy/translator/microbench/pybench/Numbers.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/microbench/pybench/Numbers.py Sun Apr 9 13:26:13 2006
@@ -0,0 +1,784 @@
+from pybench import Test
+
+class CompareIntegers(Test):
+
+ version = 0.1
+ operations = 30 * 5
+ rounds = 120000
+
+ def test(self):
+
+ for i in xrange(self.rounds):
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ 2 < 3
+ 2 > 3
+ 2 == 3
+ 2 > 3
+ 2 < 3
+
+ def calibrate(self):
+
+ for i in xrange(self.rounds):
+ pass
+
+
+class CompareFloats(Test):
+
+ version = 0.1
+ operations = 30 * 5
+ rounds = 60000
+
+ def test(self):
+
+ for i in xrange(self.rounds):
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ 2.1 < 3.31
+ 2.1 > 3.31
+ 2.1 == 3.31
+ 2.1 > 3.31
+ 2.1 < 3.31
+
+ def calibrate(self):
+
+ for i in xrange(self.rounds):
+ pass
+
+
+class CompareFloatsIntegers(Test):
+
+ version = 0.1
+ operations = 30 * 5
+ rounds = 60000
+
+ def test(self):
+
+ for i in xrange(self.rounds):
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ 2.1 < 4
+ 2.1 > 4
+ 2.1 == 4
+ 2.1 > 4
+ 2.1 < 4
+
+ def calibrate(self):
+
+ for i in xrange(self.rounds):
+ pass
+
+
+class CompareLongs(Test):
+
+ version = 0.1
+ operations = 30 * 5
+ rounds = 60000
+
+ def test(self):
+
+ for i in xrange(self.rounds):
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ 1234567890L < 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L == 3456789012345L
+ 1234567890L > 3456789012345L
+ 1234567890L < 3456789012345L
+
+ def calibrate(self):
+
+ for i in xrange(self.rounds):
+ pass
Added: pypy/dist/pypy/translator/microbench/pybench/README
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/microbench/pybench/README Sun Apr 9 13:26:13 2006
@@ -0,0 +1,76 @@
+PYBENCH - A Python Benchmark Suite
+==================================
+
+Micro-Manual
+------------
+
+Run 'pybench.py -h' to see the help screen.
+Run 'pybench.py' to just let the benchmark suite do it's thing and
+'pybench.py -f <file>' to have it store the results in a file too.
+
+Change list
+-----------
+
+0.5 -> 0.6:
+ added more tests and fixed some others
+ added overhead output
+ switched from default warp 10 to warp 20
+0.5:
+ initial release
+0.4:
+ pre-release
+
+Sample comparism output
+---------------------------------
+
+projects/pybench> pybench.py -s mxp15-O-1 -c p151-O-1
+PYBENCH 0.6
+
+Benchmark: mxp15-O-1 (rounds=10, warp=20)
+
+Tests: per run per oper. diff *
+------------------------------------------------------------------------
+ BuiltinFunctionCalls: 496.55 ms 3.89 us -25.77%
+ BuiltinMethodLookup: 634.70 ms 1.21 us -28.20%
+ ConcatStrings: 531.45 ms 3.54 us -7.49%
+ CreateInstances: 687.15 ms 16.36 us -21.10%
+ CreateStringsWithConcat: 531.15 ms 2.66 us -15.74%
+ DictCreation: 657.05 ms 4.38 us -17.14%
+ ForLoops: 684.10 ms 68.41 us -41.58%
+ IfThenElse: 720.75 ms 1.07 us -24.18%
+ ListSlicing: 547.90 ms 156.54 us -1.92%
+ NestedForLoops: 448.55 ms 1.28 us -35.98%
+ NormalClassAttribute: 790.20 ms 1.32 us -7.80%
+ NormalInstanceAttribute: 572.10 ms 0.95 us -35.66%
+ PythonFunctionCalls: 649.00 ms 3.93 us -13.90%
+ PythonMethodCalls: 570.00 ms 7.60 us -15.00%
+ Recursion: 505.55 ms 40.44 us -15.54%
+ SecondImport: 469.00 ms 18.76 us -3.82%
+ SecondPackageImport: 483.00 ms 19.32 us -5.40%
+ SecondSubmoduleImport: 613.05 ms 24.52 us -5.34%
+ SimpleComplexArithmetic: 540.10 ms 2.46 us -18.32%
+ SimpleDictManipulation: 505.60 ms 1.69 us -32.73%
+ SimpleFloatArithmetic: 552.05 ms 1.00 us -29.24%
+ SimpleIntFloatArithmetic: 509.15 ms 0.77 us -32.00%
+ SimpleIntegerArithmetic: 509.15 ms 0.77 us -32.10%
+ SimpleListManipulation: 461.10 ms 1.71 us -36.03%
+ SimpleLongArithmetic: 448.50 ms 2.72 us -22.26%
+ SmallLists: 730.55 ms 2.86 us -27.39%
+ SmallTuples: 668.10 ms 2.78 us -23.16%
+ SpecialClassAttribute: 696.25 ms 1.16 us -20.26%
+ SpecialInstanceAttribute: 682.20 ms 1.14 us -37.42%
+ StringSlicing: 481.60 ms 2.75 us -14.29%
+ TryExcept: 920.40 ms 0.61 us -6.39%
+ TryRaiseExcept: 561.05 ms 37.40 us -13.38%
+ TupleSlicing: 594.65 ms 5.66 us -6.38%
+------------------------------------------------------------------------
+ Average round time: 21895.00 ms -22.49%
+
+*) measured against: p151-O-1 (rounds=10, warp=20)
+
+Note: if you're interested in receiving the patch that turns
+Python 1.5 into mxPython1.5 (mxp15 was done with it), drop me line
+and I'll send you the URL for the patch.
+
+Have fun,
+Marc-Andre Lemburg, mailto:mal at lemburg.com
Added: pypy/dist/pypy/translator/microbench/pybench/Setup.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/microbench/pybench/Setup.py Sun Apr 9 13:26:13 2006
@@ -0,0 +1,30 @@
+#!python
+
+# Setup file for pybench
+#
+# This file has to import all tests to be run; it is executed as
+# Python source file, so you can do all kinds of manipulations here
+# rather than having to edit the tests themselves.
+#
+
+# Defaults
+Number_of_rounds = 10
+Warp_factor = 20
+
+# Import tests
+from Arithmetic import *
+from Calls import *
+from Constructs import *
+from Lookups import *
+from Instances import *
+from Lists import *
+from Tuples import *
+from Dict import *
+from Exceptions import *
+from Imports import *
+from Strings import *
+from Numbers import *
+try:
+ from Unicode import *
+except (ImportError, SyntaxError):
+ pass
Added: pypy/dist/pypy/translator/microbench/pybench/Strings.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/microbench/pybench/Strings.py Sun Apr 9 13:26:13 2006
@@ -0,0 +1,564 @@
+from pybench import Test
+from string import join
+
+class ConcatStrings(Test):
+
+ version = 0.1
+ operations = 10 * 5
+ rounds = 60000
+
+ def test(self):
+
+ # Make sure the strings are *not* interned
+ s = join(map(str,range(100)))
+ t = join(map(str,range(1,101)))
+
+ for i in xrange(self.rounds):
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ def calibrate(self):
+
+ s = join(map(str,range(100)))
+ t = join(map(str,range(1,101)))
+
+ for i in xrange(self.rounds):
+ pass
+
+
+class CompareStrings(Test):
+
+ version = 0.2
+ operations = 10 * 5
+ rounds = 200000
+
+ def test(self):
+
+ # Make sure the strings are *not* interned
+ s = join(map(str,range(10)))
+ t = join(map(str,range(10))) + "abc"
+
+ for i in xrange(self.rounds):
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ def calibrate(self):
+
+ s = join(map(str,range(10)))
+ t = join(map(str,range(10))) + "abc"
+
+ for i in xrange(self.rounds):
+ pass
+
+
+class CompareInternedStrings(Test):
+
+ version = 0.1
+ operations = 10 * 5
+ rounds = 200000
+
+ def test(self):
+
+ # Make sure the strings *are* interned
+ s = intern(join(map(str,range(10))))
+ t = s
+
+ for i in xrange(self.rounds):
+ t == s
+ t == s
+ t >= s
+ t > s
+ t < s
+
+ t == s
+ t == s
+ t >= s
+ t > s
+ t < s
+
+ t == s
+ t == s
+ t >= s
+ t > s
+ t < s
+
+ t == s
+ t == s
+ t >= s
+ t > s
+ t < s
+
+ t == s
+ t == s
+ t >= s
+ t > s
+ t < s
+
+ t == s
+ t == s
+ t >= s
+ t > s
+ t < s
+
+ t == s
+ t == s
+ t >= s
+ t > s
+ t < s
+
+ t == s
+ t == s
+ t >= s
+ t > s
+ t < s
+
+ t == s
+ t == s
+ t >= s
+ t > s
+ t < s
+
+ t == s
+ t == s
+ t >= s
+ t > s
+ t < s
+
+ def calibrate(self):
+
+ s = intern(join(map(str,range(10))))
+ t = s
+
+ for i in xrange(self.rounds):
+ pass
+
+
+class CreateStringsWithConcat(Test):
+
+ version = 0.1
+ operations = 10 * 5
+ rounds = 80000
+
+ def test(self):
+
+ for i in xrange(self.rounds):
+ s = 'om'
+ s = s + 'xbx'
+ s = s + 'xcx'
+ s = s + 'xdx'
+ s = s + 'xex'
+
+ s = s + 'xax'
+ s = s + 'xbx'
+ s = s + 'xcx'
+ s = s + 'xdx'
+ s = s + 'xex'
+
+ s = s + 'xax'
+ s = s + 'xbx'
+ s = s + 'xcx'
+ s = s + 'xdx'
+ s = s + 'xex'
+
+ s = s + 'xax'
+ s = s + 'xbx'
+ s = s + 'xcx'
+ s = s + 'xdx'
+ s = s + 'xex'
+
+ s = s + 'xax'
+ s = s + 'xbx'
+ s = s + 'xcx'
+ s = s + 'xdx'
+ s = s + 'xex'
+
+ s = s + 'xax'
+ s = s + 'xbx'
+ s = s + 'xcx'
+ s = s + 'xdx'
+ s = s + 'xex'
+
+ s = s + 'xax'
+ s = s + 'xbx'
+ s = s + 'xcx'
+ s = s + 'xdx'
+ s = s + 'xex'
+
+ s = s + 'xax'
+ s = s + 'xbx'
+ s = s + 'xcx'
+ s = s + 'xdx'
+ s = s + 'xex'
+
+ s = s + 'xax'
+ s = s + 'xbx'
+ s = s + 'xcx'
+ s = s + 'xdx'
+ s = s + 'xex'
+
+ s = s + 'xax'
+ s = s + 'xbx'
+ s = s + 'xcx'
+ s = s + 'xdx'
+ s = s + 'xex'
+
+ def calibrate(self):
+
+ for i in xrange(self.rounds):
+ pass
+
+
+class StringSlicing(Test):
+
+ version = 0.1
+ operations = 5 * 7
+ rounds = 100000
+
+ def test(self):
+
+ s = join(map(str,range(100)))
+
+ for i in xrange(self.rounds):
+
+ s[50:]
+ s[:25]
+ s[50:55]
+ s[-1:]
+ s[:1]
+ s[2:]
+ s[11:-11]
+
+ s[50:]
+ s[:25]
+ s[50:55]
+ s[-1:]
+ s[:1]
+ s[2:]
+ s[11:-11]
+
+ s[50:]
+ s[:25]
+ s[50:55]
+ s[-1:]
+ s[:1]
+ s[2:]
+ s[11:-11]
+
+ s[50:]
+ s[:25]
+ s[50:55]
+ s[-1:]
+ s[:1]
+ s[2:]
+ s[11:-11]
+
+ s[50:]
+ s[:25]
+ s[50:55]
+ s[-1:]
+ s[:1]
+ s[2:]
+ s[11:-11]
+
+ def calibrate(self):
+
+ s = join(map(str,range(100)))
+
+ for i in xrange(self.rounds):
+ pass
+
+### String methods
+
+if hasattr('', 'lower'):
+
+ class StringMappings(Test):
+
+ version = 0.1
+ operations = 3 * (5 + 4 + 2 + 1)
+ rounds = 70000
+
+ def test(self):
+
+ s = join(map(chr,range(20)),'')
+ t = join(map(chr,range(50)),'')
+ u = join(map(chr,range(100)),'')
+ v = join(map(chr,range(256)),'')
+
+ for i in xrange(self.rounds):
+
+ s.lower()
+ s.lower()
+ s.lower()
+ s.lower()
+ s.lower()
+
+ s.upper()
+ s.upper()
+ s.upper()
+ s.upper()
+ s.upper()
+
+ s.title()
+ s.title()
+ s.title()
+ s.title()
+ s.title()
+
+ t.lower()
+ t.lower()
+ t.lower()
+ t.lower()
+
+ t.upper()
+ t.upper()
+ t.upper()
+ t.upper()
+
+ t.title()
+ t.title()
+ t.title()
+ t.title()
+
+ u.lower()
+ u.lower()
+
+ u.upper()
+ u.upper()
+
+ u.title()
+ u.title()
+
+ v.lower()
+
+ v.upper()
+
+ v.title()
+
+ def calibrate(self):
+
+ s = join(map(chr,range(20)),'')
+ t = join(map(chr,range(50)),'')
+ u = join(map(chr,range(100)),'')
+ v = join(map(chr,range(256)),'')
+
+ for i in xrange(self.rounds):
+ pass
+
+ class StringPredicates(Test):
+
+ version = 0.1
+ operations = 10 * 7
+ rounds = 80000
+
+ def test(self):
+
+ data = ('abc', '123', ' ', 'äöü', 'ß'*10)
+ len_data = len(data)
+
+ for i in xrange(self.rounds):
+ s = data[i % len_data]
+
+ s.isalnum()
+ s.isalpha()
+ s.isdigit()
+ s.islower()
+ s.isspace()
+ s.istitle()
+ s.isupper()
+
+ s.isalnum()
+ s.isalpha()
+ s.isdigit()
+ s.islower()
+ s.isspace()
+ s.istitle()
+ s.isupper()
+
+ s.isalnum()
+ s.isalpha()
+ s.isdigit()
+ s.islower()
+ s.isspace()
+ s.istitle()
+ s.isupper()
+
+ s.isalnum()
+ s.isalpha()
+ s.isdigit()
+ s.islower()
+ s.isspace()
+ s.istitle()
+ s.isupper()
+
+ s.isalnum()
+ s.isalpha()
+ s.isdigit()
+ s.islower()
+ s.isspace()
+ s.istitle()
+ s.isupper()
+
+ s.isalnum()
+ s.isalpha()
+ s.isdigit()
+ s.islower()
+ s.isspace()
+ s.istitle()
+ s.isupper()
+
+ s.isalnum()
+ s.isalpha()
+ s.isdigit()
+ s.islower()
+ s.isspace()
+ s.istitle()
+ s.isupper()
+
+ s.isalnum()
+ s.isalpha()
+ s.isdigit()
+ s.islower()
+ s.isspace()
+ s.istitle()
+ s.isupper()
+
+ s.isalnum()
+ s.isalpha()
+ s.isdigit()
+ s.islower()
+ s.isspace()
+ s.istitle()
+ s.isupper()
+
+ s.isalnum()
+ s.isalpha()
+ s.isdigit()
+ s.islower()
+ s.isspace()
+ s.istitle()
+ s.isupper()
+
+ def calibrate(self):
+
+ data = ('abc', '123', ' ', '\u1234\u2345\u3456', '\uFFFF'*10)
+ data = ('abc', '123', ' ', 'äöü', 'ß'*10)
+ len_data = len(data)
+
+ for i in xrange(self.rounds):
+ s = data[i % len_data]
+
+
Added: pypy/dist/pypy/translator/microbench/pybench/Tuples.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/microbench/pybench/Tuples.py Sun Apr 9 13:26:13 2006
@@ -0,0 +1,365 @@
+from pybench import Test
+
+class TupleSlicing(Test):
+
+ version = 0.31
+ operations = 3 * 25 * 10 * 7
+ rounds = 400
+
+ def test(self):
+
+ r = range(25)
+
+ for i in xrange(self.rounds):
+
+ t = tuple(range(100))
+
+ for j in r:
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ m = t[50:]
+ m = t[:25]
+ m = t[50:55]
+ m = t[:-1]
+ m = t[1:]
+ m = t[-10:]
+ m = t[:10]
+
+ def calibrate(self):
+
+ r = range(25)
+
+ for i in xrange(self.rounds):
+
+ t = tuple(range(100))
+
+ for j in r:
+
+ pass
+
+class SmallTuples(Test):
+
+ version = 0.3
+ operations = 5*(1 + 3 + 6 + 2)
+ rounds = 80000
+
+ def test(self):
+
+ for i in xrange(self.rounds):
+
+ t = (1,2,3,4,5,6)
+
+ a,b,c,d,e,f = t
+ a,b,c,d,e,f = t
+ a,b,c,d,e,f = t
+
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+
+ l = list(t)
+ t = tuple(l)
+
+ t = (1,2,3,4,5,6)
+
+ a,b,c,d,e,f = t
+ a,b,c,d,e,f = t
+ a,b,c,d,e,f = t
+
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+
+ l = list(t)
+ t = tuple(l)
+
+ t = (1,2,3,4,5,6)
+
+ a,b,c,d,e,f = t
+ a,b,c,d,e,f = t
+ a,b,c,d,e,f = t
+
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+
+ l = list(t)
+ t = tuple(l)
+
+ t = (1,2,3,4,5,6)
+
+ a,b,c,d,e,f = t
+ a,b,c,d,e,f = t
+ a,b,c,d,e,f = t
+
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+
+ l = list(t)
+ t = tuple(l)
+
+ t = (1,2,3,4,5,6)
+
+ a,b,c,d,e,f = t
+ a,b,c,d,e,f = t
+ a,b,c,d,e,f = t
+
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+ a,b,c = t[:3]
+
+ l = list(t)
+ t = tuple(l)
+
+ def calibrate(self):
+
+ for i in xrange(self.rounds):
+ pass
+
Added: pypy/dist/pypy/translator/microbench/pybench/Unicode.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/microbench/pybench/Unicode.py Sun Apr 9 13:26:13 2006
@@ -0,0 +1,542 @@
+try:
+ unicode
+except NameError:
+ raise ImportError
+
+from pybench import Test
+from string import join
+
+class ConcatUnicode(Test):
+
+ version = 0.1
+ operations = 10 * 5
+ rounds = 60000
+
+ def test(self):
+
+ # Make sure the strings are *not* interned
+ s = unicode(join(map(str,range(100))))
+ t = unicode(join(map(str,range(1,101))))
+
+ for i in xrange(self.rounds):
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ t + s
+ t + s
+ t + s
+ t + s
+ t + s
+
+ def calibrate(self):
+
+ s = unicode(join(map(str,range(100))))
+ t = unicode(join(map(str,range(1,101))))
+
+ for i in xrange(self.rounds):
+ pass
+
+
+class CompareUnicode(Test):
+
+ version = 0.1
+ operations = 10 * 5
+ rounds = 150000
+
+ def test(self):
+
+ # Make sure the strings are *not* interned
+ s = unicode(join(map(str,range(10))))
+ t = unicode(join(map(str,range(10))) + "abc")
+
+ for i in xrange(self.rounds):
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ t < s
+ t > s
+ t == s
+ t > s
+ t < s
+
+ def calibrate(self):
+
+ s = unicode(join(map(str,range(10))))
+ t = unicode(join(map(str,range(10))) + "abc")
+
+ for i in xrange(self.rounds):
+ pass
+
+
+class CreateUnicodeWithConcat(Test):
+
+ version = 0.1
+ operations = 10 * 5
+ rounds = 80000
+
+ def test(self):
+
+ for i in xrange(self.rounds):
+ s = u'om'
+ s = s + u'xbx'
+ s = s + u'xcx'
+ s = s + u'xdx'
+ s = s + u'xex'
+
+ s = s + u'xax'
+ s = s + u'xbx'
+ s = s + u'xcx'
+ s = s + u'xdx'
+ s = s + u'xex'
+
+ s = s + u'xax'
+ s = s + u'xbx'
+ s = s + u'xcx'
+ s = s + u'xdx'
+ s = s + u'xex'
+
+ s = s + u'xax'
+ s = s + u'xbx'
+ s = s + u'xcx'
+ s = s + u'xdx'
+ s = s + u'xex'
+
+ s = s + u'xax'
+ s = s + u'xbx'
+ s = s + u'xcx'
+ s = s + u'xdx'
+ s = s + u'xex'
+
+ s = s + u'xax'
+ s = s + u'xbx'
+ s = s + u'xcx'
+ s = s + u'xdx'
+ s = s + u'xex'
+
+ s = s + u'xax'
+ s = s + u'xbx'
+ s = s + u'xcx'
+ s = s + u'xdx'
+ s = s + u'xex'
+
+ s = s + u'xax'
+ s = s + u'xbx'
+ s = s + u'xcx'
+ s = s + u'xdx'
+ s = s + u'xex'
+
+ s = s + u'xax'
+ s = s + u'xbx'
+ s = s + u'xcx'
+ s = s + u'xdx'
+ s = s + u'xex'
+
+ s = s + u'xax'
+ s = s + u'xbx'
+ s = s + u'xcx'
+ s = s + u'xdx'
+ s = s + u'xex'
+
+ def calibrate(self):
+
+ for i in xrange(self.rounds):
+ pass
+
+
+class UnicodeSlicing(Test):
+
+ version = 0.1
+ operations = 5 * 7
+ rounds = 100000
+
+ def test(self):
+
+ s = unicode(join(map(str,range(100))))
+
+ for i in xrange(self.rounds):
+
+ s[50:]
+ s[:25]
+ s[50:55]
+ s[-1:]
+ s[:1]
+ s[2:]
+ s[11:-11]
+
+ s[50:]
+ s[:25]
+ s[50:55]
+ s[-1:]
+ s[:1]
+ s[2:]
+ s[11:-11]
+
+ s[50:]
+ s[:25]
+ s[50:55]
+ s[-1:]
+ s[:1]
+ s[2:]
+ s[11:-11]
+
+ s[50:]
+ s[:25]
+ s[50:55]
+ s[-1:]
+ s[:1]
+ s[2:]
+ s[11:-11]
+
+ s[50:]
+ s[:25]
+ s[50:55]
+ s[-1:]
+ s[:1]
+ s[2:]
+ s[11:-11]
+
+ def calibrate(self):
+
+ s = unicode(join(map(str,range(100))))
+
+ for i in xrange(self.rounds):
+ pass
+
+### String methods
+
+class UnicodeMappings(Test):
+
+ version = 0.1
+ operations = 3 * (5 + 4 + 2 + 1)
+ rounds = 10000
+
+ def test(self):
+
+ s = join(map(unichr,range(20)),'')
+ t = join(map(unichr,range(100)),'')
+ u = join(map(unichr,range(500)),'')
+ v = join(map(unichr,range(1000)),'')
+
+ for i in xrange(self.rounds):
+
+ s.lower()
+ s.lower()
+ s.lower()
+ s.lower()
+ s.lower()
+
+ s.upper()
+ s.upper()
+ s.upper()
+ s.upper()
+ s.upper()
+
+ s.title()
+ s.title()
+ s.title()
+ s.title()
+ s.title()
+
+ t.lower()
+ t.lower()
+ t.lower()
+ t.lower()
+
+ t.upper()
+ t.upper()
+ t.upper()
+ t.upper()
+
+ t.title()
+ t.title()
+ t.title()
+ t.title()
+
+ u.lower()
+ u.lower()
+
+ u.upper()
+ u.upper()
+
+ u.title()
+ u.title()
+
+ v.lower()
+
+ v.upper()
+
+ v.title()
+
+ def calibrate(self):
+
+ s = join(map(unichr,range(20)),'')
+ t = join(map(unichr,range(100)),'')
+ u = join(map(unichr,range(500)),'')
+ v = join(map(unichr,range(1000)),'')
+
+ for i in xrange(self.rounds):
+ pass
+
+class UnicodePredicates(Test):
+
+ version = 0.1
+ operations = 5 * 9
+ rounds = 100000
+
+ def test(self):
+
+ data = (u'abc', u'123', u' ', u'\u1234\u2345\u3456', u'\uFFFF'*10)
+ len_data = len(data)
+
+ for i in xrange(self.rounds):
+ s = data[i % len_data]
+
+ s.isalnum()
+ s.isalpha()
+ s.isdecimal()
+ s.isdigit()
+ s.islower()
+ s.isnumeric()
+ s.isspace()
+ s.istitle()
+ s.isupper()
+
+ s.isalnum()
+ s.isalpha()
+ s.isdecimal()
+ s.isdigit()
+ s.islower()
+ s.isnumeric()
+ s.isspace()
+ s.istitle()
+ s.isupper()
+
+ s.isalnum()
+ s.isalpha()
+ s.isdecimal()
+ s.isdigit()
+ s.islower()
+ s.isnumeric()
+ s.isspace()
+ s.istitle()
+ s.isupper()
+
+ s.isalnum()
+ s.isalpha()
+ s.isdecimal()
+ s.isdigit()
+ s.islower()
+ s.isnumeric()
+ s.isspace()
+ s.istitle()
+ s.isupper()
+
+ s.isalnum()
+ s.isalpha()
+ s.isdecimal()
+ s.isdigit()
+ s.islower()
+ s.isnumeric()
+ s.isspace()
+ s.istitle()
+ s.isupper()
+
+ def calibrate(self):
+
+ data = (u'abc', u'123', u' ', u'\u1234\u2345\u3456', u'\uFFFF'*10)
+ len_data = len(data)
+
+ for i in xrange(self.rounds):
+ s = data[i % len_data]
+
+try:
+ import unicodedata
+except ImportError:
+ pass
+else:
+ class UnicodeProperties(Test):
+
+ version = 0.1
+ operations = 5 * 8
+ rounds = 100000
+
+ def test(self):
+
+ data = (u'a', u'1', u' ', u'\u1234', u'\uFFFF')
+ len_data = len(data)
+ digit = unicodedata.digit
+ numeric = unicodedata.numeric
+ decimal = unicodedata.decimal
+ category = unicodedata.category
+ bidirectional = unicodedata.bidirectional
+ decomposition = unicodedata.decomposition
+ mirrored = unicodedata.mirrored
+ combining = unicodedata.combining
+
+ for i in xrange(self.rounds):
+
+ c = data[i % len_data]
+
+ digit(c, None)
+ numeric(c, None)
+ decimal(c, None)
+ category(c)
+ bidirectional(c)
+ decomposition(c)
+ mirrored(c)
+ combining(c)
+
+ digit(c, None)
+ numeric(c, None)
+ decimal(c, None)
+ category(c)
+ bidirectional(c)
+ decomposition(c)
+ mirrored(c)
+ combining(c)
+
+ digit(c, None)
+ numeric(c, None)
+ decimal(c, None)
+ category(c)
+ bidirectional(c)
+ decomposition(c)
+ mirrored(c)
+ combining(c)
+
+ digit(c, None)
+ numeric(c, None)
+ decimal(c, None)
+ category(c)
+ bidirectional(c)
+ decomposition(c)
+ mirrored(c)
+ combining(c)
+
+ digit(c, None)
+ numeric(c, None)
+ decimal(c, None)
+ category(c)
+ bidirectional(c)
+ decomposition(c)
+ mirrored(c)
+ combining(c)
+
+ def calibrate(self):
+
+ data = (u'a', u'1', u' ', u'\u1234', u'\uFFFF')
+ len_data = len(data)
+ digit = unicodedata.digit
+ numeric = unicodedata.numeric
+ decimal = unicodedata.decimal
+ category = unicodedata.category
+ bidirectional = unicodedata.bidirectional
+ decomposition = unicodedata.decomposition
+ mirrored = unicodedata.mirrored
+ combining = unicodedata.combining
+
+ for i in xrange(self.rounds):
+
+ c = data[i % len_data]
Added: pypy/dist/pypy/translator/microbench/pybench/package/__init__.py
==============================================================================
Added: pypy/dist/pypy/translator/microbench/pybench/package/submodule.py
==============================================================================
Added: pypy/dist/pypy/translator/microbench/pybench/platform.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/microbench/pybench/platform.py Sun Apr 9 13:26:13 2006
@@ -0,0 +1,1217 @@
+#!/usr/local/bin/python
+
+""" This module tries to retrieve as much platform identifying data as
+ possible. It makes this information available via function APIs.
+
+ If called from the command line, it prints the platform
+ information concatenated as single string to stdout. The output
+ format is useable as part of a filename.
+
+ Note that this module is a fast moving target. I plan to release
+ version 1.0 as the final version.
+
+ Still needed:
+ · more support for WinCE
+ · support for MS-DOS (PythonDX ?)
+ · support for Amiga and other still unsupported platforms running Python
+ · support for additional Linux distributions
+
+ Many thanks to all those who helped adding platform specific
+ checks (in no particular order):
+
+ Charles G Waldman, David Arnold, Gordon McMillan, Ben Darnell,
+ Jeff Bauer, Cliff Crawford, Ivan Van Laningham, Josef
+ Betancourt, Randall Hopper, Karl Putland, John Farrell, Greg
+ Andruk, Just van Rossum, Thomas Heller, Mark R. Levinson, Mark
+ Hammond, Bill Tutt, Hans Nowak, Uwe Zessin (OpenVMS support),
+ Colin Kong, Trent Mick
+
+ History:
+ 0.8.0 - added sys.version parser and various new access
+ APIs (python_version(), python_compiler(), etc.)
+ 0.7.2 - fixed architecture() to use sizeof(pointer) where available
+ 0.7.1 - added support for Caldera OpenLinux
+ 0.7.0 - some fixes for WinCE; untabified the source file
+ 0.6.2 - support for OpenVMS - requires version 1.5.2-V006 or higher and
+ vms_lib.getsyi() configured
+ 0.6.1 - added code to prevent 'uname -p' on platforms which are
+ known not to support it
+ 0.6.0 - fixed win32_ver() to hopefully work on Win95,98,NT and Win2k;
+ did some cleanup of the interfaces - some APIs have changed
+ 0.5.5 - fixed another type in the MacOS code... should have
+ used more coffee today ;-)
+ 0.5.4 - fixed a few typos in the MacOS code
+ 0.5.3 - added experimental MacOS support; added better popen()
+ workarounds in _syscmd_ver() -- still not 100% elegant
+ though
+ 0.5.2 - fixed uname() to return '' instead of 'unkown' in all
+ return values (the system uname command tends to return
+ 'unkown' instead of just leaving the field emtpy)
+ 0.5.1 - included code for slackware dist; added exception handlers
+ to cover up situations where platforms don't have os.popen
+ (e.g. Mac) or fail on socket.gethostname(); fixed libc
+ detection RE
+ 0.5.0 - changed the API names referring to system commands to *syscmd*;
+ added java_ver(); made syscmd_ver() a private
+ API (was system_ver() in previous versions) -- use uname()
+ instead; extended the win32_ver() to also return processor
+ type information
+ 0.4.0 - added win32_ver() and modified the platform() output for WinXX
+ 0.3.4 - fixed a bug in _follow_symlinks()
+ 0.3.3 - fixed popen() and "file" command invokation bugs
+ 0.3.2 - added architecture() API and support for it in platform()
+ 0.3.1 - fixed syscmd_ver() RE to support Windows NT
+ 0.3.0 - added system alias support
+ 0.2.3 - removed 'wince' again... oh well.
+ 0.2.2 - added 'wince' to syscmd_ver() supported platforms
+ 0.2.1 - added cache logic and changed the platform string format
+ 0.2.0 - changed the API to use functions instead of module globals
+ since some action take too long to be run on module import
+ 0.1.0 - first release
+
+ You can always get the latest version of this module at:
+
+ http://www.lemburg.com/python/platform.py
+
+ If that URL should fail, try contacting the author.
+
+ ----------------------------------------------------------------------
+
+ Copyright (c) 1999-2000, Marc-Andre Lemburg; mailto:mal at lemburg.com
+ Copyright (c) 2000-2001, eGenix.com Software GmbH; mailto:info at egenix.com
+
+ Permission to use, copy, modify, and distribute this software and its
+ documentation for any purpose and without fee or royalty is hereby granted,
+ provided that the above copyright notice appear in all copies and that
+ both that copyright notice and this permission notice appear in
+ supporting documentation or portions thereof, including modifications,
+ that you make.
+
+ THE AUTHOR MARC-ANDRE LEMBURG DISCLAIMS ALL WARRANTIES WITH REGARD TO
+ THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
+ INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE !
+
+"""
+
+__version__ = '0.8.0'
+
+import sys,string,os,re
+
+### Platform specific APIs
+
+def libc_ver(executable=sys.executable,lib='',version='',
+
+ chunksize=2048,
+ libc_search=re.compile('(__libc_init)'
+ '|'
+ '(GLIBC_([0-9.]+))'
+ '|'
+ '(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)'
+ )
+ ):
+
+ """ Tries to determine the libc version against which the
+ file executable (defaults to the Python interpreter) is linked.
+
+ Returns a tuple of strings (lib,version) which default to the
+ given parameters in case the lookup fails.
+
+ Note that the function has intimate knowledge of how different
+ libc versions add symbols to the executable is probably only
+ useable for executables compiled using gcc.
+
+ The file is read and scanned in chunks of chunksize bytes.
+
+ """
+ f = open(executable,'rb')
+ binary = f.read(chunksize)
+ pos = 0
+ while 1:
+ m = libc_search.search(binary,pos)
+ if not m:
+ binary = f.read(chunksize)
+ if not binary:
+ break
+ pos = 0
+ continue
+ libcinit,glibc,glibcversion,so,threads,soversion = m.groups()
+ if libcinit and not lib:
+ lib = 'libc'
+ elif glibc:
+ if lib != 'glibc':
+ lib = 'glibc'
+ version = glibcversion
+ elif glibcversion > version:
+ version = glibcversion
+ elif so:
+ if lib != 'glibc':
+ lib = 'libc'
+ if soversion > version:
+ version = soversion
+ if threads and version[-len(threads):] != threads:
+ version = version + threads
+ pos = m.end()
+ f.close()
+ return lib,version
+
+def _dist_try_harder(distname,version,id):
+
+ """ Tries some special tricks to get the distribution
+ information in case the default method fails.
+
+ Currently supports older SuSE Linux, Caldera OpenLinux and
+ Slackware Linux distributions.
+
+ """
+ if os.path.exists('/var/adm/inst-log/info'):
+ # SuSE Linux stores distribution information in that file
+ info = open('/var/adm/inst-log/info').readlines()
+ distname = 'SuSE'
+ for line in info:
+ tv = string.split(line)
+ if len(tv) == 2:
+ tag,value = tv
+ else:
+ continue
+ if tag == 'MIN_DIST_VERSION':
+ version = string.strip(value)
+ elif tag == 'DIST_IDENT':
+ values = string.split(value,'-')
+ id = values[2]
+ return distname,version,id
+
+ if os.path.exists('/etc/.installed'):
+ # Caldera OpenLinux has some infos in that file (thanks to Colin Kong)
+ info = open('/etc/.installed').readlines()
+ for line in info:
+ pkg = string.split(line,'-')
+ if len(pkg) >= 2 and pkg[0] == 'OpenLinux':
+ # XXX does Caldera support non Intel platforms ? If yes,
+ # where can we find the needed id ?
+ return 'OpenLinux',pkg[1],id
+
+ if os.path.isdir('/usr/lib/setup'):
+ # Check for slackware verson tag file (thanks to Greg Andruk)
+ verfiles = os.listdir('/usr/lib/setup')
+ for n in range(len(verfiles)-1, -1, -1):
+ if verfiles[n][:14] != 'slack-version-':
+ del verfiles[n]
+ if verfiles:
+ verfiles.sort()
+ distname = 'slackware'
+ version = verfiles[-1][14:]
+ return distname,version,id
+
+ return distname,version,id
+
+def dist(distname='',version='',id='',
+
+ supported_dists=('SuSE','debian','redhat','mandrake'),
+ release_filename=re.compile('(\w+)[-_](release|version)'),
+ release_version=re.compile('([\d.]+)[^(]*(?:\((.+)\))?')):
+
+ """ Tries to determine the name of the OS distribution name
+
+ The function first looks for a distribution release file in
+ /etc and then reverts to _dist_try_harder() in case no
+ suitable files are found.
+
+ Returns a tuple distname,version,id which default to the
+ args given as parameters.
+
+ """
+ try:
+ etc = os.listdir('/etc')
+ except os.error:
+ # Probably not a Unix system
+ return distname,version,id
+ for file in etc:
+ m = release_filename.match(file)
+ if m:
+ _distname,dummy = m.groups()
+ if _distname in supported_dists:
+ distname = _distname
+ break
+ else:
+ return _dist_try_harder(distname,version,id)
+ f = open('/etc/'+file,'r')
+ firstline = f.readline()
+ f.close()
+ m = release_version.search(firstline)
+ if m:
+ _version,_id = m.groups()
+ if _version:
+ version = _version
+ if _id:
+ id = _id
+ else:
+ # Unkown format... take the first two words
+ l = string.split(string.strip(firstline))
+ if l:
+ version = l[0]
+ if len(l) > 1:
+ id = l[1]
+ return distname,version,id
+
+class _popen:
+
+ """ Fairly portable (alternative) popen implementation.
+
+ This is mostly needed in case os.popen() is not available, or
+ doesn't work as advertised, e.g. in Win9X GUI programs like
+ PythonWin or IDLE.
+
+ XXX Writing to the pipe is currently not supported.
+
+ """
+ tmpfile = ''
+ pipe = None
+ bufsize = None
+ mode = 'r'
+
+ def __init__(self,cmd,mode='r',bufsize=None):
+
+ if mode != 'r':
+ raise ValueError,'popen()-emulation only supports read mode'
+ import tempfile
+ self.tmpfile = tmpfile = tempfile.mktemp()
+ os.system(cmd + ' > %s' % tmpfile)
+ self.pipe = open(tmpfile,'rb')
+ self.bufsize = bufsize
+ self.mode = mode
+
+ def read(self):
+
+ return self.pipe.read()
+
+ def readlines(self):
+
+ if self.bufsize is not None:
+ return self.pipe.readlines()
+
+ def close(self,
+
+ remove=os.unlink,error=os.error):
+
+ if self.pipe:
+ rc = self.pipe.close()
+ else:
+ rc = 255
+ if self.tmpfile:
+ try:
+ remove(self.tmpfile)
+ except error:
+ pass
+ return rc
+
+ # Alias
+ __del__ = close
+
+def popen(cmd, mode='r', bufsize=None):
+
+ """ Portable popen() interface.
+ """
+ # Find a working popen implementation preferring win32pipe.popen
+ # over os.popen over _popen
+ popen = None
+ if os.environ.get('OS','') == 'Windows_NT':
+ # On NT win32pipe should work; on Win9x it hangs due to bugs
+ # in the MS C lib (see MS KnowledgeBase article Q150956)
+ try:
+ import win32pipe
+ except ImportError:
+ pass
+ else:
+ popen = win32pipe.popen
+ if popen is None:
+ if hasattr(os,'popen'):
+ popen = os.popen
+ # Check whether it works... it doesn't in GUI programs
+ # on Windows platforms
+ if sys.platform == 'win32': # XXX Others too ?
+ try:
+ popen('')
+ except os.error:
+ popen = _popen
+ else:
+ popen = _popen
+ if bufsize is None:
+ return popen(cmd,mode)
+ else:
+ return popen(cmd,mode,bufsize)
+
+def _norm_version(version,build=''):
+
+ """ Normalize the version and build strings and return a sinlge
+ vesion string using the format major.minor.build (or patchlevel).
+ """
+ l = string.split(version,'.')
+ if build:
+ l.append(build)
+ try:
+ ints = map(int,l)
+ except ValueError:
+ strings = l
+ else:
+ strings = map(str,ints)
+ version = string.join(strings[:3],'.')
+ return version
+
+def _syscmd_ver(system='',release='',version='',
+
+ supported_platforms=('win32','win16','dos','os2'),
+ ver_output=re.compile('(?:([\w ]+) ([\w.]+) '
+ '.*'
+ 'Version ([\d.]+))')):
+
+ """ Tries to figure out the OS version used and returns
+ a tuple (system,release,version).
+
+ It uses the "ver" shell command for this which is known
+ to exists on Windows, DOS and OS/2. XXX Others too ?
+
+ In case this fails, the given parameters are used as
+ defaults.
+
+ """
+ if sys.platform not in supported_platforms:
+ return system,release,version
+
+ # Try some common cmd strings
+ for cmd in ('ver','command /c ver','cmd /c ver'):
+ try:
+ pipe = popen(cmd)
+ info = pipe.read()
+ if pipe.close():
+ raise os.error,'command failed'
+ # XXX How can I supress shell errors from being written
+ # to stderr ?
+ except os.error,why:
+ #print 'Command %s failed: %s' % (cmd,why)
+ continue
+ except IOError,why:
+ #print 'Command %s failed: %s' % (cmd,why)
+ continue
+ else:
+ break
+ else:
+ return system,release,version
+
+ # Parse the output
+ info = string.strip(info)
+ m = ver_output.match(info)
+ if m:
+ system,release,version = m.groups()
+ # Strip trailing dots from version and release
+ if release[-1] == '.':
+ release = release[:-1]
+ if version[-1] == '.':
+ version = version[:-1]
+ # Normalize the version and build strings (eliminating additional
+ # zeros)
+ version = _norm_version(version)
+ return system,release,version
+
+def _win32_getvalue(key,name,default=''):
+
+ """ Read a value for name from the registry key.
+
+ In case this fails, default is returned.
+
+ """
+ from win32api import RegQueryValueEx
+ try:
+ return RegQueryValueEx(key,name)
+ except:
+ return default
+
+def win32_ver(release='',version='',csd='',ptype=''):
+
+ """ Get additional version information from the Windows Registry
+ and return a tuple (version,csd,ptype) referring to version
+ number, CSD level and OS type (multi/single
+ processor).
+
+ As a hint: ptype returns 'Uniprocessor Free' on single
+ processor NT machines and 'Multiprocessor Free' on multi
+ processor machines. The 'Free' refers to the OS version being
+ free of debugging code. It could also state 'Checked' which
+ means the OS version uses debugging code, i.e. code that
+ checks arguments, ranges, etc. (Thomas Heller).
+
+ Note: this functions only works if Mark Hammond's win32
+ package is installed and obviously only runs on Win32
+ compatible platforms.
+
+ XXX Is there any way to find out the processor type on WinXX ?
+
+ XXX Is win32 available on Windows CE ?
+
+ Adapted from code posted by Karl Putland to comp.lang.python.
+
+ """
+ # Import the needed APIs
+ try:
+ import win32api
+ except ImportError:
+ return release,version,csd,ptype
+ from win32api import RegQueryValueEx,RegOpenKeyEx,RegCloseKey,GetVersionEx
+ from win32con import HKEY_LOCAL_MACHINE,VER_PLATFORM_WIN32_NT,\
+ VER_PLATFORM_WIN32_WINDOWS
+
+ # Find out the registry key and some general version infos
+ maj,min,buildno,plat,csd = GetVersionEx()
+ version = '%i.%i.%i' % (maj,min,buildno & 0xFFFF)
+ if csd[:13] == 'Service Pack ':
+ csd = 'SP' + csd[13:]
+ if plat == VER_PLATFORM_WIN32_WINDOWS:
+ regkey = 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion'
+ # Try to guess the release name
+ if maj == 4:
+ if min == 0:
+ release = '95'
+ else:
+ release = '98'
+ elif maj == 5:
+ release = '2000'
+ elif plat == VER_PLATFORM_WIN32_NT:
+ regkey = 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion'
+ if maj <= 4:
+ release = 'NT'
+ elif maj == 5:
+ release = '2000'
+ else:
+ if not release:
+ # E.g. Win3.1 with win32s
+ release = '%i.%i' % (maj,min)
+ return release,version,csd,ptype
+
+ # Open the registry key
+ try:
+ keyCurVer = RegOpenKeyEx(HKEY_LOCAL_MACHINE,regkey)
+ # Get a value to make sure the key exists...
+ RegQueryValueEx(keyCurVer,'SystemRoot')
+ except:
+ return release,version,csd,ptype
+
+ # Parse values
+ #subversion = _win32_getvalue(keyCurVer,
+ # 'SubVersionNumber',
+ # ('',1))[0]
+ #if subversion:
+ # release = release + subversion # 95a, 95b, etc.
+ build = _win32_getvalue(keyCurVer,
+ 'CurrentBuildNumber',
+ ('',1))[0]
+ ptype = _win32_getvalue(keyCurVer,
+ 'CurrentType',
+ (ptype,1))[0]
+
+ # Normalize version
+ version = _norm_version(version,build)
+
+ # Close key
+ RegCloseKey(keyCurVer)
+ return release,version,csd,ptype
+
+def _mac_ver_lookup(selectors,default=None):
+
+ from gestalt import gestalt
+ l = []
+ append = l.append
+ for selector in selectors:
+ try:
+ append(gestalt(selector))
+ except RuntimeError:
+ append(default)
+ return l
+
+def _bcd2str(bcd):
+
+ return hex(bcd)[2:]
+
+def mac_ver(release='',versioninfo=('','',''),machine=''):
+
+ """ Get MacOS version information and return it as tuple (release,
+ versioninfo, machine) with versioninfo being a tuple (version,
+ dev_stage, non_release_version).
+
+ Entries which cannot be determined are set to ''. All tuple
+ entries are strings.
+
+ Thanks to Mark R. Levinson for mailing documentation links and
+ code examples for this function. Documentation for the
+ gestalt() API is available online at:
+
+ http://www.rgaros.nl/gestalt/
+
+ """
+ # Check whether the version info module is available
+ try:
+ import gestalt
+ except ImportError:
+ return release,versioninfo,machine
+ # Get the infos
+ sysv,sysu,sysa = _mac_ver_lookup(('sysv','sysu','sysa'))
+ # Decode the infos
+ if sysv:
+ major = (sysv & 0xFF00) >> 8
+ minor = (sysv & 0x00F0) >> 4
+ patch = (sysv & 0x000F)
+ release = '%s.%i.%i' % (_bcd2str(major),minor,patch)
+ if sysu:
+ major = (sysu & 0xFF000000) >> 24
+ minor = (sysu & 0x00F00000) >> 20
+ bugfix = (sysu & 0x000F0000) >> 16
+ stage = (sysu & 0x0000FF00) >> 8
+ nonrel = (sysu & 0x000000FF)
+ version = '%s.%i.%i' % (_bcd2str(major),minor,bugfix)
+ nonrel = _bcd2str(nonrel)
+ stage = {0x20:'development',
+ 0x40:'alpha',
+ 0x60:'beta',
+ 0x80:'final'}.get(stage,'')
+ versioninfo = (version,stage,nonrel)
+ if sysa:
+ machine = {0x1: '68k',
+ 0x2: 'PowerPC'}.get(sysa,'')
+ return release,versioninfo,machine
+
+def _java_getprop(self,name,default):
+
+ from java.lang import System
+ try:
+ return System.getProperty(name)
+ except:
+ return default
+
+def java_ver(release='',vendor='',vminfo=('','',''),osinfo=('','','')):
+
+ """ Version interface for JPython.
+
+ Returns a tuple (release,vendor,vminfo,osinfo) with vminfo being
+ a tuple (vm_name,vm_release,vm_vendor) and osinfo being a
+ tuple (os_name,os_version,os_arch).
+
+ Values which cannot be determined are set to the defaults
+ given as parameters (which all default to '').
+
+ """
+ # Import the needed APIs
+ try:
+ import java.lang
+ except ImportError:
+ return release,vendor,vminfo,osinfo
+
+ vendor = _java_getprop('java.vendor',vendor)
+ release = _java_getprop('java.version',release)
+ vm_name,vm_release,vm_vendor = vminfo
+ vm_name = _java_getprop('java.vm.name',vm_name)
+ vm_vendor = _java_getprop('java.vm.vendor',vm_vendor)
+ vm_release = _java_getprop('java.vm.version',vm_release)
+ vminfo = vm_name,vm_release,vm_vendor
+ os_name,os_version,os_arch = osinfo
+ os_arch = _java_getprop('java.os.arch',os_arch)
+ os_name = _java_getprop('java.os.name',os_name)
+ os_version = _java_getprop('java.os.version',os_version)
+ osinfo = os_name,os_version,os_arch
+
+ return release,vendor,vminfo,osinfo
+
+### System name aliasing
+
+def system_alias(system,release,version):
+
+ """ Returns (system,release,version) aliased to common
+ marketing names used for some systems.
+
+ It also does some reordering of the information in some cases
+ where it would otherwise cause confusion.
+
+ """
+ if system == 'Rhapsody':
+ # Apple's BSD derivative
+ # XXX How can we determine the marketing release number ?
+ return 'MacOS X Server',system+release,version
+
+ elif system == 'SunOS':
+ # Sun's OS
+ if release < '5':
+ # These releases use the old name SunOS
+ return system,release,version
+ # Modify release (marketing release = SunOS release - 3)
+ l = string.split(release,'.')
+ if l:
+ try:
+ major = int(l[0])
+ except ValueError:
+ pass
+ else:
+ major = major - 3
+ l[0] = str(major)
+ release = string.join(l,'.')
+ if release < '6':
+ system = 'Solaris'
+ else:
+ # XXX Whatever the new SunOS marketing name is...
+ system = 'Solaris'
+
+ elif system == 'IRIX64':
+ # IRIX reports IRIX64 on platforms with 64-bit support; yet it
+ # is really a version and not a different platform, since 32-bit
+ # apps are also supported..
+ system = 'IRIX'
+ if version:
+ version = version + ' (64bit)'
+ else:
+ version = '64bit'
+
+ elif system in ('win32','win16'):
+ # In case one of the other tricks
+ system = 'Windows'
+
+ return system,release,version
+
+### Various internal helpers
+
+def _platform(*args):
+
+ """ Helper to format the platform string in a filename
+ compatible format e.g. "system-version-machine".
+ """
+ # Format the platform string
+ platform = string.join(
+ map(string.strip,
+ filter(len,args)),
+ '-')
+
+ # Cleanup some possible filename obstacles...
+ replace = string.replace
+ platform = replace(platform,' ','_')
+ platform = replace(platform,'/','-')
+ platform = replace(platform,'\\','-')
+ platform = replace(platform,':','-')
+ platform = replace(platform,';','-')
+ platform = replace(platform,'"','-')
+ platform = replace(platform,'(','-')
+ platform = replace(platform,')','-')
+
+ # No need to report 'unkown' information...
+ platform = replace(platform,'unknown','')
+
+ # Fold '--'s and remove trailing '-'
+ while 1:
+ cleaned = replace(platform,'--','-')
+ if cleaned == platform:
+ break
+ platform = cleaned
+ while platform[-1] == '-':
+ platform = platform[:-1]
+
+ return platform
+
+def _node(default=''):
+
+ """ Helper to determine the node name of this machine.
+ """
+ try:
+ import socket
+ except ImportError:
+ # No sockets...
+ return default
+ try:
+ return socket.gethostname()
+ except socket.error:
+ # Still not working...
+ return default
+
+# os.path.abspath is new in Python 1.5.2:
+if not hasattr(os.path,'abspath'):
+
+ def _abspath(path,
+
+ isabs=os.path.isabs,join=os.path.join,getcwd=os.getcwd,
+ normpath=os.path.normpath):
+
+ if not isabs(path):
+ path = join(getcwd(), path)
+ return normpath(path)
+
+else:
+
+ _abspath = os.path.abspath
+
+def _follow_symlinks(filepath):
+
+ """ In case filepath is a symlink, follow it until a
+ real file is reached.
+ """
+ filepath = _abspath(filepath)
+ while os.path.islink(filepath):
+ filepath = os.path.normpath(
+ os.path.join(filepath,os.readlink(filepath)))
+ return filepath
+
+def _syscmd_uname(option,default=''):
+
+ """ Interface to the system's uname command.
+ """
+ if sys.platform in ('dos','win32','win16','os2'):
+ # XXX Others too ?
+ return default
+ try:
+ f = os.popen('uname %s 2> /dev/null' % option)
+ except (AttributeError,os.error):
+ return default
+ output = string.strip(f.read())
+ rc = f.close()
+ if not output or rc:
+ return default
+ else:
+ return output
+
+def _syscmd_file(target,default=''):
+
+ """ Interface to the system's file command.
+
+ The function uses the -b option of the file command to have it
+ ommit the filename in its output and if possible the -L option
+ to have the command follow symlinks. It returns default in
+ case the command should fail.
+
+ """
+ target = _follow_symlinks(target)
+ try:
+ f = os.popen('file %s 2> /dev/null' % target)
+ except (AttributeError,os.error):
+ return default
+ output = string.strip(f.read())
+ rc = f.close()
+ if not output or rc:
+ return default
+ else:
+ return output
+
+### Information about the used architecture
+
+# Default values for architecture; non-empty strings override the
+# defaults given as parameters
+_default_architecture = {
+ 'win32': ('','WindowsPE'),
+ 'win16': ('','Windows'),
+ 'dos': ('','MSDOS'),
+}
+
+def architecture(executable=sys.executable,bits='',linkage='',
+
+ split=re.compile('[\s,]').split):
+
+ """ Queries the given executable (defaults to the Python interpreter
+ binary) for various architecture informations.
+
+ Returns a tuple (bits,linkage) which contain information about
+ the bit architecture and the linkage format used for the
+ executable. Both values are returned as strings.
+
+ Values that cannot be determined are returned as given by the
+ parameter presets. If bits is given as '', the sizeof(pointer)
+ (or sizeof(long) on Python version < 1.5.2) is used as
+ indicator for the supported pointer size.
+
+ The function relies on the system's "file" command to do the
+ actual work. This is available on most if not all Unix
+ platforms. On some non-Unix platforms and then only if the
+ executable points to the Python interpreter defaults from
+ _default_architecture are used.
+
+ """
+ # Use the sizeof(pointer) as default number of bits if nothing
+ # else is given as default.
+ if not bits:
+ import struct
+ try:
+ size = struct.calcsize('P')
+ except struct.error:
+ # Older installations can only query longs
+ size = struct.calcsize('l')
+ bits = str(size*8) + 'bit'
+
+ # Get data from the 'file' system command
+ output = _syscmd_file(executable,'')
+
+ if not output and \
+ executable == sys.executable:
+ # "file" command did not return anything; we'll try to provide
+ # some sensible defaults then...
+ if _default_architecture.has_key(sys.platform):
+ b,l = _default_architecture[sys.platform]
+ if b:
+ bits = b
+ if l:
+ linkage = l
+ return bits,linkage
+
+ # Split the output into a list of strings omitting the filename
+ fileout = split(output)[1:]
+
+ if 'executable' not in fileout:
+ # Format not supported
+ return bits,linkage
+
+ # Bits
+ if '32-bit' in fileout:
+ bits = '32bit'
+ elif 'N32' in fileout:
+ # On Irix only
+ bits = 'n32bit'
+ elif '64-bit' in fileout:
+ bits = '64bit'
+
+ # Linkage
+ if 'ELF' in fileout:
+ linkage = 'ELF'
+ elif 'PE' in fileout:
+ # E.g. Windows uses this format
+ if 'Windows' in fileout:
+ linkage = 'WindowsPE'
+ else:
+ linkage = 'PE'
+ elif 'COFF' in fileout:
+ linkage = 'COFF'
+ elif 'MS-DOS' in fileout:
+ linkage = 'MSDOS'
+ else:
+ # XXX the A.OUT format also falls under this class...
+ pass
+
+ return bits,linkage
+
+### Portable uname() interface
+
+_uname_cache = None
+
+def uname():
+
+ """ Fairly portable uname interface. Returns a tuple
+ of strings (system,node,release,version,machine,processor)
+ identifying the underlying platform.
+
+ Note that unlike the os.uname function this also returns
+ possible processor information as additional tuple entry.
+
+ Entries which cannot be determined are set to ''.
+
+ """
+ global _uname_cache
+
+ if _uname_cache is not None:
+ return _uname_cache
+
+ # Get some infos from the builtin os.uname API...
+ try:
+ system,node,release,version,machine = os.uname()
+
+ except AttributeError:
+ # Hmm, no uname... we'll have to poke around the system then.
+ system = sys.platform
+ release = ''
+ version = ''
+ node = _node()
+ machine = ''
+ processor = ''
+ use_syscmd_ver = 1
+
+ # Try win32_ver() on win32 platforms
+ if system == 'win32':
+ release,version,csd,ptype = win32_ver()
+ if release and version:
+ use_syscmd_ver = 0
+
+ # Try the 'ver' system command available on some
+ # platforms
+ if use_syscmd_ver:
+ system,release,version = _syscmd_ver(system)
+
+ # In case we still don't know anything useful, we'll try to
+ # help ourselves
+ if system in ('win32','win16'):
+ if not version:
+ if system == 'win32':
+ version = '32bit'
+ else:
+ version = '16bit'
+ system = 'Windows'
+
+ elif system[:4] == 'java':
+ release,vendor,vminfo,osinfo = java_ver()
+ system = 'Java'
+ version = string.join(vminfo,', ')
+ if not version:
+ version = vendor
+
+ elif os.name == 'mac':
+ release,(version,stage,nonrel),machine = mac_ver()
+ system = 'MacOS'
+
+ else:
+ # System specific extensions
+ if system == 'OpenVMS':
+ # OpenVMS seems to have release and version mixed up
+ if not release or release == '0':
+ release = version
+ version = ''
+ # Get processor information
+ try:
+ import vms_lib
+ except ImportError:
+ pass
+ else:
+ csid, cpu_number = vms_lib.getsyi('SYI$_CPU',0)
+ if (cpu_number >= 128):
+ processor = 'Alpha'
+ else:
+ processor = 'VAX'
+ else:
+ # Get processor information from the uname system command
+ processor = _syscmd_uname('-p','')
+
+ # 'unkown' is not really any useful as information; we'll convert
+ # it to '' which is more portable
+ if system == 'unknown':
+ system = ''
+ if node == 'unknown':
+ node = ''
+ if release == 'unknown':
+ release = ''
+ if version == 'unknown':
+ version = ''
+ if machine == 'unknown':
+ machine = ''
+ if processor == 'unknown':
+ processor = ''
+ _uname_cache = system,node,release,version,machine,processor
+ return _uname_cache
+
+### Direct interfaces to some of the uname() return values
+
+def system():
+
+ """ Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'.
+
+ An empty string is returned if the value cannot be determined.
+
+ """
+ return uname()[0]
+
+def node():
+
+ """ Returns the computer's network name (may not be fully qualified !)
+
+ An empty string is returned if the value cannot be determined.
+
+ """
+ return uname()[1]
+
+def release():
+
+ """ Returns the system's release, e.g. '2.2.0' or 'NT'
+
+ An empty string is returned if the value cannot be determined.
+
+ """
+ return uname()[2]
+
+def version():
+
+ """ Returns the system's release version, e.g. '#3 on degas'
+
+ An empty string is returned if the value cannot be determined.
+
+ """
+ return uname()[3]
+
+def machine():
+
+ """ Returns the machine type, e.g. 'i386'
+
+ An empty string is returned if the value cannot be determined.
+
+ """
+ return uname()[4]
+
+def processor():
+
+ """ Returns the (true) processor name, e.g. 'amdk6'
+
+ An empty string is returned if the value cannot be
+ determined. Note that many platforms do not provide this
+ information or simply return the same value as for machine(),
+ e.g. NetBSD does this.
+
+ """
+ return uname()[5]
+
+### Various APIs for extracting information from sys.version
+
+_sys_version_parser = re.compile('([\w.+]+)\s*'
+ '\(#(\d+),\s*([\w ]+),\s*([\w :]+)\)\s*'
+ '\[([^\]]+)\]?')
+_sys_version_cache = None
+
+def _sys_version():
+
+ """ Returns a parsed version of Python's sys.version as tuple
+ (version, buildno, builddate, compiler) referring to the Python
+ version, build number, build date/time as string and the compiler
+ identification string.
+
+ Note that unlike the Python sys.version, the returned value
+ for the Python version will always include the patchlevel (it
+ defaults to '.0').
+
+ """
+ global _sys_version_cache
+ import sys, re, time
+
+ if _sys_version_cache is not None:
+ return _sys_version_cache
+ version, buildno, builddate, buildtime, compiler = \
+ _sys_version_parser.match(sys.version).groups()
+ buildno = int(buildno)
+ builddate = builddate + ' ' + buildtime
+ l = string.split(version, '.')
+ if len(l) == 2:
+ l.append('0')
+ version = string.join(l, '.')
+ _sys_version_cache = (version, buildno, builddate, compiler)
+ return _sys_version_cache
+
+def python_version():
+
+ """ Returns the Python version as string 'major.minor.patchlevel'
+
+ Note that unlike the Python sys.version, the returned value
+ will always include the patchlevel (it defaults to 0).
+
+ """
+ return _sys_version()[0]
+
+def python_build():
+
+ """ Returns a tuple (buildno, buildate) stating the Python
+ build number and date as strings.
+
+ """
+ return _sys_version()[1:3]
+
+def python_compiler():
+
+ """ Returns a string identifying the compiler used for compiling
+ Python.
+
+ """
+ return _sys_version()[3]
+
+### The Opus Magnum of platform strings :-)
+
+_platform_cache = None
+_platform_aliased_cache = None
+
+def platform(aliased=0, terse=0):
+
+ """ Returns a single string identifying the underlying platform
+ with as much useful information as possible (but no more :).
+
+ The output is intended to be human readable rather than
+ machine parseable. It may look different on different
+ platforms and this is intended.
+
+ If "aliased" is true, the function will use aliases for
+ various platforms that report system names which differ from
+ their common names, e.g. SunOS will be reported as
+ Solaris. The system_alias() function is used to implement
+ this.
+
+ Setting terse to true causes the function to return only the
+ absolute minimum information needed to identify the platform.
+
+ """
+ global _platform_cache,_platform_aliased_cache
+
+ if not aliased and (_platform_cache is not None):
+ return _platform_cache
+ elif _platform_aliased_cache is not None:
+ return _platform_aliased_cache
+
+ # Get uname information and then apply platform specific cosmetics
+ # to it...
+ system,node,release,version,machine,processor = uname()
+ if machine == processor:
+ processor = ''
+ if aliased:
+ system,release,version = system_alias(system,release,version)
+
+ if system == 'Windows':
+ # MS platforms
+ rel,vers,csd,ptype = win32_ver(version)
+ if terse:
+ platform = _platform(system,release)
+ else:
+ platform = _platform(system,release,version,csd)
+
+ elif system in ('Linux',):
+ # Linux based systems
+ distname,distversion,distid = dist('')
+ if distname and not terse:
+ platform = _platform(system,release,machine,processor,
+ 'with',
+ distname,distversion,distid)
+ else:
+ # If the distribution name is unknown check for libc vs. glibc
+ libcname,libcversion = libc_ver(sys.executable)
+ platform = _platform(system,release,machine,processor,
+ 'with',
+ libcname+libcversion)
+ elif system == 'Java':
+ # Java platforms
+ r,v,vminfo,(os_name,os_version,os_arch) = java_ver()
+ if terse:
+ platform = _platform(system,release,version)
+ else:
+ platform = _platform(system,release,version,
+ 'on',
+ os_name,os_version,os_arch)
+
+ elif system == 'MacOS':
+ # MacOS platforms
+ if terse:
+ platform = _platform(system,release)
+ else:
+ platform = _platform(system,release,machine)
+
+ else:
+ # Generic handler
+ if terse:
+ platform = _platform(system,release)
+ else:
+ bits,linkage = architecture(sys.executable)
+ platform = _platform(system,release,machine,processor,bits,linkage)
+
+ if aliased:
+ _platform_aliased_cache = platform
+ elif terse:
+ pass
+ else:
+ _platform_cache = platform
+ return platform
+
+if __name__ == '__main__':
+ # Default is to print the aliased verbose platform string
+ terse = ('terse' in sys.argv or '--terse' in sys.argv)
+ aliased = (not 'nonaliased' in sys.argv and not '--nonaliased' in sys.argv)
+ print platform(aliased,terse)
+ sys.exit(0)
Added: pypy/dist/pypy/translator/microbench/pybench/pybench.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/microbench/pybench/pybench.py Sun Apr 9 13:26:13 2006
@@ -0,0 +1,390 @@
+#!/usr/local/bin/python -O
+
+""" A Python Benchmark Suite
+"""
+__copyright__="""\
+ Copyright (c), 1997-2001, Marc-Andre Lemburg (mal at lemburg.com)
+
+ All Rights Reserved.
+
+ Permission to use, copy, modify, and distribute this software and
+ its documentation for any purpose and without fee or royalty is
+ hereby granted, provided that the above copyright notice appear in
+ all copies and that both that copyright notice and this permission
+ notice appear in supporting documentation or portions thereof,
+ including modifications, that you make.
+
+ THE AUTHOR MARC-ANDRE LEMBURG DISCLAIMS ALL WARRANTIES WITH REGARD
+ TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE
+ FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ SOFTWARE !
+
+"""
+
+__version__ = '1.0'
+
+#
+# NOTE: Use xrange for all test loops unless you want to face
+# a 20MB process !
+#
+# All tests should have rounds set to values so that a run()
+# takes between 20-50 seconds. This is to get fairly good
+# clock() values. You can use option -w to speedup the tests
+# by a fixed integer factor (the "warp factor").
+#
+
+import sys,time,operator
+from CommandLine import *
+
+try:
+ import cPickle
+ pickle = cPickle
+except ImportError:
+ import pickle
+
+### Test baseclass
+
+class Test:
+
+ """ All test must have this class as baseclass. It provides
+ the necessary interface to the benchmark machinery.
+
+ The tests must set .rounds to a value high enough to let the
+ test run between 20-50 seconds. This is needed because
+ clock()-timing only gives rather inaccurate values (on Linux,
+ for example, it is accurate to a few hundreths of a
+ second). If you don't want to wait that long, use a warp
+ factor larger than 1.
+
+ It is also important to set the .operations variable to a
+ value representing the number of "virtual operations" done per
+ call of .run().
+
+ If you change a test in some way, don't forget to increase
+ it's version number.
+
+ """
+ operations = 1 # number of operations done per test()-call
+ rounds = 100000 # number of rounds per run
+ is_a_test = 1 # identifier
+ last_timing = (0,0,0) # last timing (real,run,calibration)
+ warp = 1 # warp factor this test uses
+ cruns = 20 # number of calibration runs
+ overhead = None # list of calibration timings
+
+ version = 1.0 # version number of this test
+
+ def __init__(self,warp=1):
+
+ if warp > 1:
+ self.rounds = self.rounds / warp
+ self.warp = warp
+ self.times = []
+ self.overhead = []
+ # We want these to be in the instance dict, so that pickle
+ # saves them
+ self.version = self.version
+ self.operations = self.operations
+ self.rounds = self.rounds
+
+ def run(self):
+
+ """ Run the test in two phases: first calibrate, then
+ do the actual test. Be careful to keep the calibration
+ timing low w/r to the test timing.
+ """
+ test = self.test
+ calibrate = self.calibrate
+ clock = time.clock
+ cruns = self.cruns
+ # first calibrate
+ offset = 0.0
+ for i in range(cruns):
+ t = clock()
+ calibrate()
+ t = clock() - t
+ offset = offset + t
+ offset = offset / cruns
+ # now the real thing
+ t = clock()
+ test()
+ t = clock() - t
+ self.last_timing = (t-offset,t,offset)
+ self.times.append(t-offset)
+
+ def calibrate(self):
+
+ """ Run the test, doing self.rounds loops, but without
+ the actual test target in place.
+ """
+ return
+
+ def test(self):
+
+ """ Run the test, doing self.rounds loop
+ """
+ # do some tests
+ return
+
+ def stat(self):
+
+ """ Returns two value: average time per run and average per
+ operation.
+ """
+ runs = len(self.times)
+ if runs == 0:
+ return 0,0
+ totaltime = reduce(operator.add,self.times,0.0)
+ avg = totaltime / float(runs)
+ op_avg = totaltime / float(runs * self.rounds * self.operations)
+ if self.overhead:
+ totaloverhead = reduce(operator.add,self.overhead,0.0)
+ ov_avg = totaloverhead / float(runs)
+ else:
+ # use self.last_timing - not too accurate
+ ov_avg = self.last_timing[2]
+ return avg,op_avg,ov_avg
+
+### load Setup
+import Setup
+
+### Benchmark base class
+
+class Benchmark:
+
+ name = '?' # Name of the benchmark
+ rounds = 1 # Number of rounds to run
+ warp = 1 # Warp factor
+ roundtime = 0 # Average round time
+ version = None # Benchmark version number (see __init__)
+
+ def __init__(self):
+
+ self.tests = {}
+ self.version = 0.31
+
+ def load_tests(self,setupmod,warp=1):
+
+ self.warp = warp
+ tests = self.tests
+ print 'Searching for tests...'
+ setupmod.__dict__.values()
+ for c in setupmod.__dict__.values():
+ if hasattr(c,'is_a_test') and c.__name__ != 'Test':
+ tests[c.__name__] = c(warp)
+ l = tests.keys()
+ l.sort()
+ for t in l:
+ print ' ',t
+ print
+
+ def run(self):
+
+ tests = self.tests.items()
+ tests.sort()
+ clock = time.clock
+ print 'Running %i round(s) of the suite: ' % self.rounds
+ print
+ roundtime = clock()
+ for i in range(self.rounds):
+ print ' Round %-25i real abs overhead' % (i+1)
+ for j in range(len(tests)):
+ name,t = tests[j]
+ print '%30s:' % name,
+ t.run()
+ print ' %.3fr %.3fa %.3fo' % t.last_timing
+ print ' ----------------------'
+ print ' Average round time: %.3f seconds' % \
+ ((clock() - roundtime)/(i+1))
+ print
+ self.roundtime = (clock() - roundtime) / self.rounds
+ print
+
+ def print_stat(self, compare_to=None, hidenoise=0):
+
+ if not compare_to:
+ print '%-30s per run per oper. overhead' % 'Tests:'
+ print '-'*72
+ tests = self.tests.items()
+ tests.sort()
+ for name,t in tests:
+ avg,op_avg,ov_avg = t.stat()
+ print '%30s: %10.2f ms %7.2f us %7.2f ms' % \
+ (name,avg*1000.0,op_avg*1000000.0,ov_avg*1000.0)
+ print '-'*72
+ print '%30s: %10.2f ms' % \
+ ('Average round time',self.roundtime * 1000.0)
+
+ else:
+ print '%-30s per run per oper. diff *)' % \
+ 'Tests:'
+ print '-'*72
+ tests = self.tests.items()
+ tests.sort()
+ compatible = 1
+ for name,t in tests:
+ avg,op_avg,ov_avg = t.stat()
+ try:
+ other = compare_to.tests[name]
+ except KeyError:
+ other = None
+ if other and other.version == t.version and \
+ other.operations == t.operations:
+ avg1,op_avg1,ov_avg1 = other.stat()
+ qop_avg = (op_avg/op_avg1-1.0)*100.0
+ if hidenoise and abs(qop_avg) < 10:
+ qop_avg = ''
+ else:
+ qop_avg = '%+7.2f%%' % qop_avg
+ else:
+ qavg,qop_avg = 'n/a', 'n/a'
+ compatible = 0
+ print '%30s: %10.2f ms %7.2f us %8s' % \
+ (name,avg*1000.0,op_avg*1000000.0,qop_avg)
+ print '-'*72
+ if compatible and compare_to.roundtime > 0 and \
+ compare_to.version == self.version:
+ print '%30s: %10.2f ms %+7.2f%%' % \
+ ('Average round time',self.roundtime * 1000.0,
+ ((self.roundtime*self.warp)/
+ (compare_to.roundtime*compare_to.warp)-1.0)*100.0)
+ else:
+ print '%30s: %10.2f ms n/a' % \
+ ('Average round time',self.roundtime * 1000.0)
+ print
+ print '*) measured against: %s (rounds=%i, warp=%i)' % \
+ (compare_to.name,compare_to.rounds,compare_to.warp)
+ print
+
+def print_machine():
+
+ import platform
+ print 'Machine Details:'
+ print ' Platform ID: %s' % platform.platform()
+ # There's a bug in Python 2.2b1+...
+ if 1 or sys.version[:6] != '2.2b1+':
+ print ' Python: %s' % platform.python_version()
+ print ' Compiler: %s' % platform.python_compiler()
+ buildno, buildate = platform.python_build()
+ print ' Build: %s (#%i)' % (buildate, buildno)
+
+class PyBenchCmdline(Application):
+
+ header = ("PYBENCH - a benchmark test suite for Python "
+ "interpreters/compilers.")
+
+ version = __version__
+
+ options = [ArgumentOption('-n','number of rounds',Setup.Number_of_rounds),
+ ArgumentOption('-f','save benchmark to file arg',''),
+ ArgumentOption('-c','compare benchmark with the one in file arg',''),
+ ArgumentOption('-s','show benchmark in file arg, then exit',''),
+ ArgumentOption('-w','set warp factor to arg',Setup.Warp_factor),
+ SwitchOption('-d','hide noise in compares', 0),
+ SwitchOption('--no-gc','disable garbage collection', 0),
+ ]
+
+ about = """\
+The normal operation is to run the suite and display the
+results. Use -f to save them for later reuse or comparisms.
+
+Examples:
+
+python1.5 pybench.py -w 100 -f p15
+python1.4 pybench.py -w 100 -f p14
+python pybench.py -s p15 -c p14
+"""
+ copyright = __copyright__
+
+ def main(self):
+
+ rounds = self.values['-n']
+ reportfile = self.values['-f']
+ show_bench = self.values['-s']
+ compare_to = self.values['-c']
+ hidenoise = self.values['-d']
+ warp = self.values['-w']
+ nogc = self.values['--no-gc']
+
+ # Switch off GC
+ if nogc:
+ try:
+ import gc
+ except ImportError:
+ nogc = 0
+ else:
+ if self.values['--no-gc']:
+ gc.disable()
+
+ print 'PYBENCH',__version__
+ print
+
+ if not compare_to:
+ print_machine()
+ print
+
+ if compare_to:
+ try:
+ f = open(compare_to,'rb')
+ bench = pickle.load(f)
+ bench.name = compare_to
+ f.close()
+ compare_to = bench
+ except IOError:
+ print '* Error opening/reading file',compare_to
+ compare_to = None
+
+ if show_bench:
+ try:
+ f = open(show_bench,'rb')
+ bench = pickle.load(f)
+ bench.name = show_bench
+ f.close()
+ print 'Benchmark: %s (rounds=%i, warp=%i)' % \
+ (bench.name,bench.rounds,bench.warp)
+ print
+ bench.print_stat(compare_to, hidenoise)
+ except IOError:
+ print '* Error opening/reading file',show_bench
+ print
+ return
+
+ if reportfile:
+ if nogc:
+ print 'Benchmark: %s (rounds=%i, warp=%i, no GC)' % \
+ (reportfile,rounds,warp)
+ else:
+ print 'Benchmark: %s (rounds=%i, warp=%i)' % \
+ (reportfile,rounds,warp)
+ print
+
+ # Create benchmark object
+ bench = Benchmark()
+ bench.rounds = rounds
+ bench.load_tests(Setup,warp)
+ try:
+ bench.run()
+ except KeyboardInterrupt:
+ print
+ print '*** KeyboardInterrupt -- Aborting'
+ print
+ return
+ bench.print_stat(compare_to)
+ # ring bell
+ sys.stderr.write('\007')
+
+ if reportfile:
+ try:
+ f = open(reportfile,'wb')
+ bench.name = reportfile
+ pickle.dump(bench,f)
+ f.close()
+ except IOError:
+ print '* Error opening/writing reportfile'
+
+if __name__ == '__main__':
+ PyBenchCmdline()
Added: pypy/dist/pypy/translator/microbench/pybench/python2.4.2.bench
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/microbench/pybench/python2.4.2.bench Sun Apr 9 13:26:13 2006
@@ -0,0 +1,1711 @@
+(i__main__
+Benchmark
+p1
+(dp2
+S'tests'
+p3
+(dp4
+S'SpecialInstanceAttribute'
+p5
+(iLookups
+SpecialInstanceAttribute
+p6
+(dp7
+S'operations'
+p8
+I120
+sS'warp'
+p9
+I20
+sS'times'
+p10
+(lp11
+F0.20949999999999996
+aF0.18950000000000128
+aF0.18949999999999764
+aF0.19899999999999932
+aF0.18949999999999764
+aF0.18949999999999784
+aF0.18949999999999784
+aF0.20950000000000096
+aF0.19950000000000295
+aF0.19949999999998838
+asS'version'
+p12
+F0.29999999999999999
+sS'overhead'
+p13
+(lp14
+sS'rounds'
+p15
+I5000
+sS'last_timing'
+p16
+(F0.19949999999998838
+F0.19999999999998863
+F0.00050000000000025577
+tp17
+sbsS'PythonFunctionCalls'
+p18
+(iCalls
+PythonFunctionCalls
+p19
+(dp20
+g8
+I55
+sg9
+I20
+sg10
+(lp21
+F0.10949999999999986
+aF0.10949999999999944
+aF0.11000000000000298
+aF0.10949999999999935
+aF0.10999999999999943
+aF0.11949999999999719
+aF0.10949999999999918
+aF0.10949999999999918
+aF0.10949999999999953
+aF0.10999999999999943
+asg12
+F0.29999999999999999
+sg13
+(lp22
+sg15
+I3000
+sg16
+(F0.10999999999999943
+F0.10999999999999943
+F0
+tp23
+sbsS'CompareFloatsIntegers'
+p24
+(iNumbers
+CompareFloatsIntegers
+p25
+(dp26
+g8
+I150
+sg9
+I20
+sg10
+(lp27
+F0.13
+aF0.13999999999999968
+aF0.12950000000000078
+aF0.12949999999999892
+aF0.12949999999999892
+aF0.12950000000000267
+aF0.1294999999999952
+aF0.13000000000000256
+aF0.13950000000000068
+aF0.12950000000000267
+asg12
+F0.10000000000000001
+sg13
+(lp28
+sg15
+I3000
+sg16
+(F0.12950000000000267
+F0.13000000000000256
+F0.00049999999999990048
+tp29
+sbsS'PythonMethodCalls'
+p30
+(iCalls
+PythonMethodCalls
+p31
+(dp32
+g8
+I75
+sg9
+I20
+sg10
+(lp33
+F0.12000000000000011
+aF0.12000000000000099
+aF0.10999999999999943
+aF0.10999999999999943
+aF0.12000000000000099
+aF0.11999999999999744
+aF0.10999999999999943
+aF0.10999999999999943
+aF0.10999999999999943
+aF0.10949999999999953
+asg12
+F0.29999999999999999
+sg13
+(lp34
+sg15
+I1000
+sg16
+(F0.10949999999999953
+F0.10999999999999943
+F0.00049999999999990048
+tp35
+sbsS'SecondSubmoduleImport'
+p36
+(iImports
+SecondSubmoduleImport
+p37
+(dp38
+g8
+I25
+sg9
+I20
+sg10
+(lp39
+F0.080000000000000071
+aF0.079500000000000084
+aF0.080000000000001847
+aF0.080000000000001847
+aF0.069999999999996732
+aF0.079999999999998295
+aF0.079999999999998295
+aF0.079999999999998295
+aF0.079999999999998295
+aF0.079999999999998295
+asg12
+F0.10000000000000001
+sg13
+(lp40
+sg15
+I1000
+sg16
+(F0.079999999999998295
+F0.079999999999998295
+F0
+tp41
+sbsS'DictWithIntegerKeys'
+p42
+(iDict
+DictWithIntegerKeys
+p43
+(dp44
+g8
+I60
+sg9
+I20
+sg10
+(lp45
+F0.12899999999999989
+aF0.12899999999999903
+aF0.12899999999999903
+aF0.12900000000000258
+aF0.1390000000000006
+aF0.12850000000000286
+aF0.13900000000000076
+aF0.12899999999999529
+aF0.12899999999999529
+aF0.13900000000000076
+asg12
+F0.10000000000000001
+sg13
+(lp46
+sg15
+I10000
+sg16
+(F0.13900000000000076
+F0.14000000000000057
+F0.00099999999999980096
+tp47
+sbsS'UnicodeSlicing'
+p48
+(iUnicode
+UnicodeSlicing
+p49
+(dp50
+g8
+I35
+sg9
+I20
+sg10
+(lp51
+F0.10950000000000033
+aF0.11950000000000101
+aF0.10949999999999935
+aF0.10949999999999953
+aF0.10949999999999918
+aF0.10950000000000663
+aF0.10949999999999953
+aF0.10899999999999962
+aF0.10849999999999937
+aF0.10949999999999989
+asg12
+F0.10000000000000001
+sg13
+(lp52
+sg15
+I5000
+sg16
+(F0.10949999999999989
+F0.10999999999999943
+F0.0004999999999995453
+tp53
+sbsS'NestedForLoops'
+p54
+(iConstructs
+NestedForLoops
+p55
+(dp56
+g8
+I50000
+sg9
+I20
+sg10
+(lp57
+F0.060000000000000053
+aF0.060000000000000497
+aF0.059500000000000511
+aF0.060000000000002274
+aF0.060000000000002274
+aF0.060000000000002274
+aF0.060000000000002274
+aF0.059999999999995168
+aF0.059999999999995168
+aF0.070000000000000284
+asg12
+F0.29999999999999999
+sg13
+(lp58
+sg15
+I7
+sg16
+(F0.070000000000000284
+F0.070000000000000284
+F0
+tp59
+sbsS'UnicodePredicates'
+p60
+(iUnicode
+UnicodePredicates
+p61
+(dp62
+g8
+I45
+sg9
+I20
+sg10
+(lp63
+F0.1180000000000001
+aF0.12800000000000084
+aF0.13800000000000043
+aF0.11799999999999748
+aF0.12799999999999551
+aF0.12799999999999551
+aF0.11800000000000459
+aF0.12800000000000261
+aF0.12799999999999551
+aF0.12800000000001005
+asg12
+F0.10000000000000001
+sg13
+(lp64
+sg15
+I5000
+sg16
+(F0.12800000000001005
+F0.13000000000000966
+F0.0019999999999996019
+tp65
+sbsS'ForLoops'
+p66
+(iConstructs
+ForLoops
+p67
+(dp68
+g8
+I25
+sg9
+I20
+sg10
+(lp69
+F0.070000000000000284
+aF0.069500000000000298
+aF0.070000000000000284
+aF0.070000000000000284
+aF0.070000000000000284
+aF0.079499999999998044
+aF0.069500000000000034
+aF0.070000000000000284
+aF0.070000000000000284
+aF0.070000000000000284
+asg12
+F0.10000000000000001
+sg13
+(lp70
+sg15
+I400
+sg16
+(F0.070000000000000284
+F0.070000000000000284
+F0
+tp71
+sbsS'ConcatStrings'
+p72
+(iStrings
+ConcatStrings
+p73
+(dp74
+g8
+I50
+sg9
+I20
+sg10
+(lp75
+F0.099499999999999866
+aF0.099500000000000546
+aF0.099500000000001435
+aF0.099499999999997785
+aF0.088999999999999885
+aF0.098999999999994162
+aF0.088999999999996152
+aF0.10949999999999953
+aF0.099500000000001518
+aF0.099500000000001518
+asg12
+F0.10000000000000001
+sg13
+(lp76
+sg15
+I3000
+sg16
+(F0.099500000000001518
+F0.10000000000000142
+F0.00049999999999990048
+tp77
+sbsS'SecondPackageImport'
+p78
+(iImports
+SecondPackageImport
+p79
+(dp80
+g8
+I25
+sg9
+I20
+sg10
+(lp81
+F0.059500000000000039
+aF0.060000000000000497
+aF0.059499999999998644
+aF0.059499999999998644
+aF0.059999999999998721
+aF0.060000000000002274
+aF0.060000000000002274
+aF0.05950000000000237
+aF0.069500000000000034
+aF0.070000000000000284
+asg12
+F0.10000000000000001
+sg13
+(lp82
+sg15
+I1000
+sg16
+(F0.070000000000000284
+F0.070000000000000284
+F0
+tp83
+sbsS'CompareIntegers'
+p84
+(iNumbers
+CompareIntegers
+p85
+(dp86
+g8
+I150
+sg9
+I20
+sg10
+(lp87
+F0.089499999999999968
+aF0.08950000000000076
+aF0.099499999999999658
+aF0.089499999999999955
+aF0.089499999999999774
+aF0.089499999999996402
+aF0.089499999999996055
+aF0.089499999999996055
+aF0.099500000000001518
+aF0.099500000000001518
+asg12
+F0.10000000000000001
+sg13
+(lp88
+sg15
+I6000
+sg16
+(F0.099500000000001518
+F0.10000000000000142
+F0.00049999999999990048
+tp89
+sbsS'CreateStringsWithConcat'
+p90
+(iStrings
+CreateStringsWithConcat
+p91
+(dp92
+g8
+I50
+sg9
+I20
+sg10
+(lp93
+F0.049500000000000044
+aF0.060000000000000497
+aF0.049500000000000724
+aF0.049500000000000634
+aF0.049500000000000807
+aF0.04950000000000436
+aF0.049499999999997255
+aF0.059999999999995168
+aF0.060000000000002274
+aF0.04950000000000436
+asg12
+F0.10000000000000001
+sg13
+(lp94
+sg15
+I4000
+sg16
+(F0.04950000000000436
+F0.050000000000004263
+F0.00049999999999990048
+tp95
+sbsS'SmallLists'
+p96
+(iLists
+SmallLists
+p97
+(dp98
+g8
+I85
+sg9
+I20
+sg10
+(lp99
+F0.11949999999999919
+aF0.11950000000000101
+aF0.11899999999999747
+aF0.11949999999999736
+aF0.11950000000000109
+aF0.11899999999999729
+aF0.11900000000000474
+aF0.11949999999999754
+aF0.11949999999999754
+aF0.11949999999999719
+asg12
+F0.29999999999999999
+sg13
+(lp100
+sg15
+I3000
+sg16
+(F0.11949999999999719
+F0.11999999999999744
+F0.00050000000000025577
+tp101
+sbsS'CompareUnicode'
+p102
+(iUnicode
+CompareUnicode
+p103
+(dp104
+g8
+I50
+sg9
+I20
+sg10
+(lp105
+F0.1095000000000001
+aF0.11950000000000008
+aF0.10899999999999946
+aF0.10899999999999946
+aF0.10949999999999935
+aF0.099000000000001614
+aF0.099000000000001614
+aF0.10949999999999918
+aF0.10899999999999928
+aF0.10900000000000673
+asg12
+F0.10000000000000001
+sg13
+(lp106
+sg15
+I7500
+sg16
+(F0.10900000000000673
+F0.11000000000000654
+F0.00099999999999980096
+tp107
+sbsS'SimpleListManipulation'
+p108
+(iLists
+SimpleListManipulation
+p109
+(dp110
+g8
+I90
+sg9
+I20
+sg10
+(lp111
+F0.069500000000000298
+aF0.079500000000000084
+aF0.05950000000000237
+aF0.05950000000000237
+aF0.070000000000000284
+aF0.069500000000000034
+aF0.059499999999994911
+aF0.059499999999994911
+aF0.05950000000000237
+aF0.070000000000000284
+asg12
+F0.20000000000000001
+sg13
+(lp112
+sg15
+I3000
+sg16
+(F0.070000000000000284
+F0.070000000000000284
+F0
+tp113
+sbsS'DictWithFloatKeys'
+p114
+(iDict
+DictWithFloatKeys
+p115
+(dp116
+g8
+I60
+sg9
+I20
+sg10
+(lp117
+F0.22899999999999998
+aF0.23900000000000024
+aF0.22900000000000045
+aF0.22900000000000045
+aF0.22900000000000045
+aF0.22900000000000417
+aF0.22850000000000392
+aF0.22899999999999671
+aF0.22899999999999671
+aF0.22900000000000417
+asg12
+F0.10000000000000001
+sg13
+(lp118
+sg15
+I10000
+sg16
+(F0.22900000000000417
+F0.23000000000000398
+F0.00099999999999980096
+tp119
+sbsS'TryExcept'
+p120
+(iExceptions
+TryExcept
+p121
+(dp122
+g8
+I150
+sg9
+I20
+sg10
+(lp123
+F0.17900000000000063
+aF0.17899999999999974
+aF0.17899999999999974
+aF0.17899999999999974
+aF0.18899999999999756
+aF0.16900000000000154
+aF0.17899999999999991
+aF0.17899999999999991
+aF0.17899999999999991
+aF0.1789999999999928
+asg12
+F0.10000000000000001
+sg13
+(lp124
+sg15
+I10000
+sg16
+(F0.1789999999999928
+F0.17999999999999261
+F0.00099999999999980096
+tp125
+sbsS'SimpleDictManipulation'
+p126
+(iDict
+SimpleDictManipulation
+p127
+(dp128
+g8
+I120
+sg9
+I20
+sg10
+(lp129
+F0.089500000000000315
+aF0.089999999999999858
+aF0.088999999999999885
+aF0.079499999999998211
+aF0.089999999999999858
+aF0.090000000000003411
+aF0.090000000000003411
+aF0.079499999999998391
+aF0.079499999999998391
+aF0.079499999999998044
+asg12
+F0.29999999999999999
+sg13
+(lp130
+sg15
+I2500
+sg16
+(F0.079499999999998044
+F0.079999999999998295
+F0.00050000000000025577
+tp131
+sbsS'TryRaiseExcept'
+p132
+(iExceptions
+TryRaiseExcept
+p133
+(dp134
+g8
+I5
+sg9
+I20
+sg10
+(lp135
+F0.099499999999999658
+aF0.10000000000000142
+aF0.089499999999999955
+aF0.099499999999997785
+aF0.10000000000000142
+aF0.10000000000000142
+aF0.089499999999996055
+aF0.089500000000003507
+aF0.089500000000003507
+aF0.10999999999999943
+asg12
+F0.10000000000000001
+sg13
+(lp136
+sg15
+I3000
+sg16
+(F0.10999999999999943
+F0.10999999999999943
+F0
+tp137
+sbsS'IfThenElse'
+p138
+(iConstructs
+IfThenElse
+p139
+(dp140
+g8
+I90
+sg9
+I20
+sg10
+(lp141
+F0.068999999999999839
+aF0.069500000000000298
+aF0.069000000000000311
+aF0.069000000000000311
+aF0.079499999999998211
+aF0.069500000000000381
+aF0.069500000000000381
+aF0.069000000000000131
+aF0.069000000000000131
+aF0.068999999999993025
+asg12
+F0.31
+sg13
+(lp142
+sg15
+I7500
+sg16
+(F0.068999999999993025
+F0.069999999999993179
+F0.0010000000000001564
+tp143
+sbsS'NormalInstanceAttribute'
+p144
+(iLookups
+NormalInstanceAttribute
+p145
+(dp146
+g8
+I120
+sg9
+I20
+sg10
+(lp147
+F0.14949999999999991
+aF0.14950000000000035
+aF0.15900000000000017
+aF0.15900000000000017
+aF0.15950000000000006
+aF0.14949999999999869
+aF0.14949999999999869
+aF0.1594999999999967
+aF0.14949999999999833
+aF0.15950000000000381
+asg12
+F0.29999999999999999
+sg13
+(lp148
+sg15
+I5000
+sg16
+(F0.15950000000000381
+F0.16000000000000369
+F0.00049999999999990048
+tp149
+sbsS'BuiltinFunctionCalls'
+p150
+(iCalls
+BuiltinFunctionCalls
+p151
+(dp152
+g8
+I85
+sg9
+I20
+sg10
+(lp153
+F0.089999999999999969
+aF0.10000000000000053
+aF0.080000000000000071
+aF0.079500000000001944
+aF0.10000000000000142
+aF0.079499999999998391
+aF0.079499999999998391
+aF0.089999999999996305
+aF0.079999999999998295
+aF0.079999999999998295
+asg12
+F0.40000000000000002
+sg13
+(lp154
+sg15
+I1500
+sg16
+(F0.079999999999998295
+F0.079999999999998295
+F0
+tp155
+sbsS'UnicodeMappings'
+p156
+(iUnicode
+UnicodeMappings
+p157
+(dp158
+g8
+I36
+sg9
+I20
+sg10
+(lp159
+F0.21849999999999975
+aF0.22900000000000045
+aF0.21899999999999889
+aF0.20850000000000096
+aF0.2189999999999987
+aF0.22900000000000417
+aF0.21849999999999881
+aF0.20800000000000091
+aF0.2085000000000008
+aF0.21899999999999836
+asg12
+F0.10000000000000001
+sg13
+(lp160
+sg15
+I500
+sg16
+(F0.21899999999999836
+F0.21999999999999886
+F0.0010000000000005115
+tp161
+sbsS'CompareFloats'
+p162
+(iNumbers
+CompareFloats
+p163
+(dp164
+g8
+I150
+sg9
+I20
+sg10
+(lp165
+F0.089499999999999968
+aF0.08949999999999983
+aF0.099999999999999645
+aF0.089999999999999858
+aF0.089499999999999955
+aF0.089500000000003507
+aF0.089499999999996402
+aF0.089499999999996402
+aF0.090000000000003411
+aF0.090000000000003411
+asg12
+F0.10000000000000001
+sg13
+(lp166
+sg15
+I3000
+sg16
+(F0.090000000000003411
+F0.090000000000003411
+F0
+tp167
+sbsS'StringMappings'
+p168
+(iStrings
+StringMappings
+p169
+(dp170
+g8
+I36
+sg9
+I20
+sg10
+(lp171
+F0.34949999999999959
+aF0.35949999999999943
+aF0.33899999999999986
+aF0.34950000000000137
+aF0.34900000000000142
+aF0.34900000000000125
+aF0.34949999999999404
+aF0.34949999999999404
+aF0.34950000000000153
+aF0.34949999999999404
+asg12
+F0.10000000000000001
+sg13
+(lp172
+sg15
+I3500
+sg16
+(F0.34949999999999404
+F0.34999999999999432
+F0.00050000000000025577
+tp173
+sbsS'Recursion'
+p174
+(iCalls
+Recursion
+p175
+(dp176
+g8
+I5
+sg9
+I20
+sg10
+(lp177
+F0.069499999999999854
+aF0.080000000000000071
+aF0.069500000000000201
+aF0.069500000000000201
+aF0.079999999999998295
+aF0.070000000000000284
+aF0.070000000000000284
+aF0.069500000000000381
+aF0.069500000000000034
+aF0.0800000000000054
+asg12
+F0.29999999999999999
+sg13
+(lp178
+sg15
+I2500
+sg16
+(F0.0800000000000054
+F0.0800000000000054
+F0
+tp179
+sbsS'SimpleLongArithmetic'
+p180
+(iArithmetic
+SimpleLongArithmetic
+p181
+(dp182
+g8
+I110
+sg9
+I20
+sg10
+(lp183
+F0.079500000000000084
+aF0.080000000000000071
+aF0.079500000000001944
+aF0.079999999999998295
+aF0.080000000000001847
+aF0.069500000000000381
+aF0.069500000000000034
+aF0.0800000000000054
+aF0.079999999999998295
+aF0.079999999999998295
+asg12
+F0.29999999999999999
+sg13
+(lp184
+sg15
+I1500
+sg16
+(F0.079999999999998295
+F0.079999999999998295
+F0
+tp185
+sbsS'UnicodeProperties'
+p186
+(iUnicode
+UnicodeProperties
+p187
+(dp188
+g8
+I40
+sg9
+I20
+sg10
+(lp189
+F0.13799999999999968
+aF0.12799999999999895
+aF0.12799999999999906
+aF0.13800000000000043
+aF0.12799999999999515
+aF0.12799999999999515
+aF0.13800000000000062
+aF0.12800000000000261
+aF0.12799999999999515
+aF0.12800000000001005
+asg12
+F0.10000000000000001
+sg13
+(lp190
+sg15
+I5000
+sg16
+(F0.12800000000001005
+F0.13000000000000966
+F0.0019999999999996019
+tp191
+sbsS'SimpleIntFloatArithmetic'
+p192
+(iArithmetic
+SimpleIntFloatArithmetic
+p193
+(dp194
+g8
+I110
+sg9
+I20
+sg10
+(lp195
+F0.08949999999999983
+aF0.089499999999999871
+aF0.088999999999999885
+aF0.089000000000003437
+aF0.088999999999999885
+aF0.089500000000003507
+aF0.089500000000003507
+aF0.088999999999996152
+aF0.088999999999996152
+aF0.089500000000003507
+asg12
+F0.29999999999999999
+sg13
+(lp196
+sg15
+I6000
+sg16
+(F0.089500000000003507
+F0.090000000000003411
+F0.00049999999999990048
+tp197
+sbsS'CreateUnicodeWithConcat'
+p198
+(iUnicode
+CreateUnicodeWithConcat
+p199
+(dp200
+g8
+I50
+sg9
+I20
+sg10
+(lp201
+F0.15949999999999992
+aF0.14949999999999858
+aF0.14949999999999858
+aF0.14950000000000224
+aF0.1494999999999985
+aF0.14949999999999869
+aF0.14949999999999833
+aF0.14949999999999833
+aF0.17000000000000171
+aF0.14949999999999869
+asg12
+F0.10000000000000001
+sg13
+(lp202
+sg15
+I4000
+sg16
+(F0.14949999999999869
+F0.14999999999999858
+F0.00049999999999990048
+tp203
+sbsS'ListSlicing'
+p204
+(iLists
+ListSlicing
+p205
+(dp206
+g8
+I175
+sg9
+I20
+sg10
+(lp207
+F0.080000000000000071
+aF0.069500000000000298
+aF0.060000000000000497
+aF0.059999999999998721
+aF0.059999999999998721
+aF0.05950000000000237
+aF0.069500000000000381
+aF0.05950000000000237
+aF0.079999999999998295
+aF0.060000000000002274
+asg12
+F0.40000000000000002
+sg13
+(lp208
+sg15
+I20
+sg16
+(F0.060000000000002274
+F0.060000000000002274
+F0
+tp209
+sbsS'CompareLongs'
+p210
+(iNumbers
+CompareLongs
+p211
+(dp212
+g8
+I150
+sg9
+I20
+sg10
+(lp213
+F0.099500000000000088
+aF0.089499999999999871
+aF0.089499999999999871
+aF0.079500000000001944
+aF0.089999999999999858
+aF0.090000000000003411
+aF0.090000000000003411
+aF0.089500000000003507
+aF0.089500000000003507
+aF0.089499999999996055
+asg12
+F0.10000000000000001
+sg13
+(lp214
+sg15
+I3000
+sg16
+(F0.089499999999996055
+F0.089999999999996305
+F0.00050000000000025577
+tp215
+sbsS'SimpleIntegerArithmetic'
+p216
+(iArithmetic
+SimpleIntegerArithmetic
+p217
+(dp218
+g8
+I110
+sg9
+I20
+sg10
+(lp219
+F0.089499999999999871
+aF0.089499999999999871
+aF0.089499999999999774
+aF0.099500000000001518
+aF0.099499999999997785
+aF0.089499999999996402
+aF0.089499999999996402
+aF0.089499999999996402
+aF0.089499999999996055
+aF0.088999999999996152
+asg12
+F0.29999999999999999
+sg13
+(lp220
+sg15
+I6000
+sg16
+(F0.088999999999996152
+F0.089999999999996305
+F0.0010000000000001564
+tp221
+sbsS'SpecialClassAttribute'
+p222
+(iLookups
+SpecialClassAttribute
+p223
+(dp224
+g8
+I120
+sg9
+I20
+sg10
+(lp225
+F0.14949999999999944
+aF0.14950000000000035
+aF0.15950000000000025
+aF0.1494999999999985
+aF0.15950000000000025
+aF0.15950000000000381
+aF0.15950000000000381
+aF0.14949999999999869
+aF0.14949999999999869
+aF0.15949999999999634
+asg12
+F0.29999999999999999
+sg13
+(lp226
+sg15
+I5000
+sg16
+(F0.15949999999999634
+F0.15999999999999659
+F0.00050000000000025577
+tp227
+sbsS'SecondImport'
+p228
+(iImports
+SecondImport
+p229
+(dp230
+g8
+I25
+sg9
+I20
+sg10
+(lp231
+F0.060000000000000053
+aF0.059999999999998721
+aF0.059999999999998721
+aF0.059999999999998721
+aF0.060000000000002274
+aF0.059499999999994911
+aF0.05950000000000237
+aF0.060000000000002274
+aF0.059999999999995168
+aF0.059999999999995168
+asg12
+F0.10000000000000001
+sg13
+(lp232
+sg15
+I1000
+sg16
+(F0.059999999999995168
+F0.059999999999995168
+F0
+tp233
+sbsS'TupleSlicing'
+p234
+(iTuples
+TupleSlicing
+p235
+(dp236
+g8
+I5250
+sg9
+I20
+sg10
+(lp237
+F0.099499999999999617
+aF0.10999999999999943
+aF0.099499999999997785
+aF0.099500000000001337
+aF0.10999999999999943
+aF0.10999999999999943
+aF0.099499999999994065
+aF0.099500000000001518
+aF0.10999999999999943
+aF0.10999999999999943
+asg12
+F0.31
+sg13
+(lp238
+sg15
+I20
+sg16
+(F0.10999999999999943
+F0.10999999999999943
+F0
+tp239
+sbsS'SimpleFloatArithmetic'
+p240
+(iArithmetic
+SimpleFloatArithmetic
+p241
+(dp242
+g8
+I110
+sg9
+I20
+sg10
+(lp243
+F0.089499999999999871
+aF0.099499999999999561
+aF0.089499999999999774
+aF0.099499999999997785
+aF0.099500000000001518
+aF0.099500000000001518
+aF0.099500000000001518
+aF0.088999999999996152
+aF0.099500000000001518
+aF0.10949999999999953
+asg12
+F0.29999999999999999
+sg13
+(lp244
+sg15
+I5000
+sg16
+(F0.10949999999999953
+F0.10999999999999943
+F0.00049999999999990048
+tp245
+sbsS'StringPredicates'
+p246
+(iStrings
+StringPredicates
+p247
+(dp248
+g8
+I70
+sg9
+I20
+sg10
+(lp249
+F0.1884999999999995
+aF0.17850000000000152
+aF0.18799999999999759
+aF0.18850000000000139
+aF0.17849999999999966
+aF0.17799999999999977
+aF0.17800000000000687
+aF0.18849999999999767
+aF0.19849999999999568
+aF0.18850000000001188
+asg12
+F0.10000000000000001
+sg13
+(lp250
+sg15
+I4000
+sg16
+(F0.18850000000001188
+F0.19000000000001194
+F0.0015000000000000568
+tp251
+sbsS'BuiltinMethodLookup'
+p252
+(iLookups
+BuiltinMethodLookup
+p253
+(dp254
+g8
+I150
+sg9
+I20
+sg10
+(lp255
+F0.16000000000000003
+aF0.15999999999999925
+aF0.15950000000000014
+aF0.15950000000000025
+aF0.16000000000000014
+aF0.14949999999999833
+aF0.14950000000000579
+aF0.16000000000000369
+aF0.15949999999999634
+aF0.15949999999999634
+asg12
+F0.29999999999999999
+sg13
+(lp256
+sg15
+I3500
+sg16
+(F0.15949999999999634
+F0.15999999999999659
+F0.00050000000000025577
+tp257
+sbsS'SimpleComplexArithmetic'
+p258
+(iArithmetic
+SimpleComplexArithmetic
+p259
+(dp260
+g8
+I110
+sg9
+I20
+sg10
+(lp261
+F0.12999999999999989
+aF0.099499999999999658
+aF0.099999999999997868
+aF0.099999999999997868
+aF0.099500000000001337
+aF0.099500000000001518
+aF0.10949999999999953
+aF0.10000000000000142
+aF0.10000000000000142
+aF0.10000000000000142
+asg12
+F0.29999999999999999
+sg13
+(lp262
+sg15
+I2000
+sg16
+(F0.10000000000000142
+F0.10000000000000142
+F0
+tp263
+sbsS'ConcatUnicode'
+p264
+(iUnicode
+ConcatUnicode
+p265
+(dp266
+g8
+I50
+sg9
+I20
+sg10
+(lp267
+F0.11950000000000011
+aF0.10949999999999944
+aF0.10949999999999944
+aF0.10949999999999935
+aF0.10899999999999946
+aF0.10899999999999928
+aF0.10899999999999928
+aF0.10949999999999953
+aF0.10949999999999953
+aF0.10949999999999953
+asg12
+F0.10000000000000001
+sg13
+(lp268
+sg15
+I3000
+sg16
+(F0.10949999999999953
+F0.10999999999999943
+F0.00049999999999990048
+tp269
+sbsS'CompareInternedStrings'
+p270
+(iStrings
+CompareInternedStrings
+p271
+(dp272
+g8
+I50
+sg9
+I20
+sg10
+(lp273
+F0.078999999999999959
+aF0.079000000000000098
+aF0.079000000000000098
+aF0.078500000000001791
+aF0.088999999999999885
+aF0.088999999999996152
+aF0.098999999999994162
+aF0.078999999999998141
+aF0.078999999999998141
+aF0.078999999999998488
+asg12
+F0.10000000000000001
+sg13
+(lp274
+sg15
+I10000
+sg16
+(F0.078999999999998488
+F0.079999999999998295
+F0.00099999999999980096
+tp275
+sbsS'CompareStrings'
+p276
+(iStrings
+CompareStrings
+p277
+(dp278
+g8
+I50
+sg9
+I20
+sg10
+(lp279
+F0.10899999999999987
+aF0.1089999999999994
+aF0.099000000000001448
+aF0.099000000000001448
+aF0.10899999999999946
+aF0.10899999999999928
+aF0.10899999999999928
+aF0.10899999999999962
+aF0.099000000000001614
+aF0.10899999999999928
+asg12
+F0.20000000000000001
+sg13
+(lp280
+sg15
+I10000
+sg16
+(F0.10899999999999928
+F0.10999999999999943
+F0.0010000000000001564
+tp281
+sbsS'SmallTuples'
+p282
+(iTuples
+SmallTuples
+p283
+(dp284
+g8
+I60
+sg9
+I20
+sg10
+(lp285
+F0.1094999999999994
+aF0.10949999999999944
+aF0.11000000000000298
+aF0.10949999999999935
+aF0.10950000000000308
+aF0.10999999999999943
+aF0.10949999999999953
+aF0.10949999999999918
+aF0.10950000000000663
+aF0.10949999999999953
+asg12
+F0.29999999999999999
+sg13
+(lp286
+sg15
+I4000
+sg16
+(F0.10949999999999953
+F0.10999999999999943
+F0.00049999999999990048
+tp287
+sbsS'NormalClassAttribute'
+p288
+(iLookups
+NormalClassAttribute
+p289
+(dp290
+g8
+I120
+sg9
+I20
+sg10
+(lp291
+F0.16949999999999993
+aF0.16949999999999993
+aF0.15950000000000025
+aF0.15950000000000025
+aF0.16950000000000182
+aF0.16950000000000182
+aF0.16950000000000182
+aF0.16950000000000146
+aF0.16949999999999435
+aF0.16950000000000182
+asg12
+F0.29999999999999999
+sg13
+(lp292
+sg15
+I5000
+sg16
+(F0.16950000000000182
+F0.17000000000000171
+F0.00049999999999990048
+tp293
+sbsS'CreateInstances'
+p294
+(iInstances
+CreateInstances
+p295
+(dp296
+g8
+I14
+sg9
+I20
+sg10
+(lp297
+F0.1399999999999999
+aF0.14000000000000057
+aF0.12900000000000081
+aF0.13949999999999693
+aF0.12949999999999892
+aF0.14000000000000057
+aF0.14000000000000057
+aF0.13950000000000032
+aF0.12950000000000267
+aF0.12950000000000267
+asg12
+F0.20000000000000001
+sg13
+(lp298
+sg15
+I3000
+sg16
+(F0.12950000000000267
+F0.13000000000000256
+F0.00049999999999990048
+tp299
+sbsS'DictWithStringKeys'
+p300
+(iDict
+DictWithStringKeys
+p301
+(dp302
+g8
+I60
+sg9
+I20
+sg10
+(lp303
+F0.10899999999999987
+aF0.098499999999999588
+aF0.11899999999999915
+aF0.10899999999999946
+aF0.10899999999999946
+aF0.098999999999994162
+aF0.098999999999994162
+aF0.10899999999999962
+aF0.10899999999999928
+aF0.10899999999999928
+asg12
+F0.10000000000000001
+sg13
+(lp304
+sg15
+I10000
+sg16
+(F0.10899999999999928
+F0.10999999999999943
+F0.0010000000000001564
+tp305
+sbsS'DictCreation'
+p306
+(iDict
+DictCreation
+p307
+(dp308
+g8
+I50
+sg9
+I20
+sg10
+(lp309
+F0.09000000000000008
+aF0.079499999999999987
+aF0.089499999999999774
+aF0.089499999999999955
+aF0.089499999999999774
+aF0.079500000000005497
+aF0.079499999999998391
+aF0.089999999999996305
+aF0.089999999999996305
+aF0.089500000000003507
+asg12
+F0.29999999999999999
+sg13
+(lp310
+sg15
+I3000
+sg16
+(F0.089500000000003507
+F0.090000000000003411
+F0.00049999999999990048
+tp311
+sbsS'StringSlicing'
+p312
+(iStrings
+StringSlicing
+p313
+(dp314
+g8
+I35
+sg9
+I20
+sg10
+(lp315
+F0.099499999999999617
+aF0.099499999999999658
+aF0.089000000000003437
+aF0.099500000000001518
+aF0.098999999999997895
+aF0.099000000000001614
+aF0.10949999999999953
+aF0.099500000000001171
+aF0.099500000000001171
+aF0.099500000000008984
+asg12
+F0.10000000000000001
+sg13
+(lp316
+sg15
+I5000
+sg16
+(F0.099500000000008984
+F0.10000000000000853
+F0.0004999999999995453
+tp317
+sbssS'name'
+p318
+S'python2.4.2.bench'
+p319
+sS'roundtime'
+p320
+F6.5750000000000002
+sg9
+I20
+sg12
+F0.31
+sg15
+I10
+sb.
\ No newline at end of file
More information about the Pypy-commit
mailing list