summaryrefslogtreecommitdiffstats
path: root/Tools/pybench/Constructs.py
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-04-21 10:40:58 (GMT)
committerThomas Wouters <thomas@python.org>2006-04-21 10:40:58 (GMT)
commit49fd7fa4431da299196d74087df4a04f99f9c46f (patch)
tree35ace5fe78d3d52c7a9ab356ab9f6dbf8d4b71f4 /Tools/pybench/Constructs.py
parent9ada3d6e29d5165dadacbe6be07bcd35cfbef59d (diff)
downloadcpython-49fd7fa4431da299196d74087df4a04f99f9c46f.zip
cpython-49fd7fa4431da299196d74087df4a04f99f9c46f.tar.gz
cpython-49fd7fa4431da299196d74087df4a04f99f9c46f.tar.bz2
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
number of tests, all because of the codecs/_multibytecodecs issue described here (it's not a Py3K issue, just something Py3K discovers): http://mail.python.org/pipermail/python-dev/2006-April/064051.html Hye-Shik Chang promised to look for a fix, so no need to fix it here. The tests that are expected to break are: test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecs test_multibytecodec This merge fixes an actual test failure (test_weakref) in this branch, though, so I believe merging is the right thing to do anyway.
Diffstat (limited to 'Tools/pybench/Constructs.py')
-rw-r--r--Tools/pybench/Constructs.py565
1 files changed, 565 insertions, 0 deletions
diff --git a/Tools/pybench/Constructs.py b/Tools/pybench/Constructs.py
new file mode 100644
index 0000000..aba888f
--- /dev/null
+++ b/Tools/pybench/Constructs.py
@@ -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
+