annotate Tools/pybench/Strings.py @ 79675:c0a2294de787 2.7

Issue #16199: Backport 2to3 typo fix from 3.2.
author Chris Jerdonek <chris.jerdonek@gmail.com>
date Thu, 11 Oct 2012 16:15:46 -0700
parents 2167105123e4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
1 from pybench import Test
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
2 from string import join
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
3
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
4 class ConcatStrings(Test):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
5
38801
2167105123e4 Updated to pybench 2.0.
Marc-André Lemburg <mal@egenix.com>
parents: 38392
diff changeset
6 version = 2.0
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
7 operations = 10 * 5
38801
2167105123e4 Updated to pybench 2.0.
Marc-André Lemburg <mal@egenix.com>
parents: 38392
diff changeset
8 rounds = 100000
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
9
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
10 def test(self):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
11
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
12 # Make sure the strings are *not* interned
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
13 s = join(map(str,range(100)))
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
14 t = join(map(str,range(1,101)))
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
15
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
16 for i in xrange(self.rounds):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
17 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
18 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
19 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
20 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
21 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
22
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
23 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
24 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
25 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
26 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
27 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
28
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
29 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
30 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
31 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
32 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
33 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
34
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
35 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
36 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
37 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
38 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
39 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
40
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
41 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
42 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
43 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
44 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
45 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
46
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
47 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
48 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
49 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
50 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
51 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
52
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
53 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
54 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
55 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
56 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
57 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
58
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
59 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
60 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
61 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
62 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
63 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
64
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
65 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
66 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
67 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
68 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
69 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
70
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
71 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
72 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
73 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
74 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
75 t + s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
76
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
77 def calibrate(self):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
78
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
79 s = join(map(str,range(100)))
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
80 t = join(map(str,range(1,101)))
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
81
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
82 for i in xrange(self.rounds):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
83 pass
37903
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
84
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
85
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
86 class CompareStrings(Test):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
87
38801
2167105123e4 Updated to pybench 2.0.
Marc-André Lemburg <mal@egenix.com>
parents: 38392
diff changeset
88 version = 2.0
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
89 operations = 10 * 5
38392
816f8e60097a Revert tests to MAL's original round sizes to retiain comparability
Steve Holden <steve@holdenweb.com>
parents: 38375
diff changeset
90 rounds = 200000
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
91
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
92 def test(self):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
93
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
94 # Make sure the strings are *not* interned
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
95 s = join(map(str,range(10)))
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
96 t = join(map(str,range(10))) + "abc"
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
97
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
98 for i in xrange(self.rounds):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
99 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
100 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
101 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
102 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
103 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
104
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
105 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
106 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
107 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
108 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
109 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
110
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
111 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
112 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
113 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
114 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
115 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
116
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
117 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
118 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
119 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
120 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
121 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
122
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
123 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
124 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
125 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
126 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
127 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
128
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
129 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
130 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
131 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
132 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
133 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
134
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
135 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
136 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
137 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
138 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
139 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
140
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
141 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
142 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
143 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
144 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
145 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
146
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
147 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
148 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
149 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
150 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
151 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
152
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
153 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
154 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
155 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
156 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
157 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
158
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
159 def calibrate(self):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
160
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
161 s = join(map(str,range(10)))
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
162 t = join(map(str,range(10))) + "abc"
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
163
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
164 for i in xrange(self.rounds):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
165 pass
37903
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
166
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
167
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
168 class CompareInternedStrings(Test):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
169
38801
2167105123e4 Updated to pybench 2.0.
Marc-André Lemburg <mal@egenix.com>
parents: 38392
diff changeset
170 version = 2.0
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
171 operations = 10 * 5
38801
2167105123e4 Updated to pybench 2.0.
Marc-André Lemburg <mal@egenix.com>
parents: 38392
diff changeset
172 rounds = 300000
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
173
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
174 def test(self):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
175
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
176 # Make sure the strings *are* interned
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
177 s = intern(join(map(str,range(10))))
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
178 t = s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
179
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
180 for i in xrange(self.rounds):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
181 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
182 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
183 t >= s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
184 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
185 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
186
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
187 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
188 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
189 t >= s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
190 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
191 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
192
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
193 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
194 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
195 t >= s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
196 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
197 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
198
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
199 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
200 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
201 t >= s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
202 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
203 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
204
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
205 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
206 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
207 t >= s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
208 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
209 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
210
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
211 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
212 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
213 t >= s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
214 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
215 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
216
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
217 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
218 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
219 t >= s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
220 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
221 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
222
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
223 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
224 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
225 t >= s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
226 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
227 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
228
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
229 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
230 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
231 t >= s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
232 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
233 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
234
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
235 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
236 t == s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
237 t >= s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
238 t > s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
239 t < s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
240
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
241 def calibrate(self):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
242
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
243 s = intern(join(map(str,range(10))))
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
244 t = s
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
245
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
246 for i in xrange(self.rounds):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
247 pass
37903
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
248
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
249
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
250 class CreateStringsWithConcat(Test):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
251
38801
2167105123e4 Updated to pybench 2.0.
Marc-André Lemburg <mal@egenix.com>
parents: 38392
diff changeset
252 version = 2.0
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
253 operations = 10 * 5
38801
2167105123e4 Updated to pybench 2.0.
Marc-André Lemburg <mal@egenix.com>
parents: 38392
diff changeset
254 rounds = 200000
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
255
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
256 def test(self):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
257
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
258 for i in xrange(self.rounds):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
259 s = 'om'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
260 s = s + 'xbx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
261 s = s + 'xcx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
262 s = s + 'xdx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
263 s = s + 'xex'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
264
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
265 s = s + 'xax'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
266 s = s + 'xbx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
267 s = s + 'xcx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
268 s = s + 'xdx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
269 s = s + 'xex'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
270
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
271 s = s + 'xax'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
272 s = s + 'xbx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
273 s = s + 'xcx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
274 s = s + 'xdx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
275 s = s + 'xex'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
276
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
277 s = s + 'xax'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
278 s = s + 'xbx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
279 s = s + 'xcx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
280 s = s + 'xdx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
281 s = s + 'xex'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
282
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
283 s = s + 'xax'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
284 s = s + 'xbx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
285 s = s + 'xcx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
286 s = s + 'xdx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
287 s = s + 'xex'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
288
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
289 s = s + 'xax'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
290 s = s + 'xbx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
291 s = s + 'xcx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
292 s = s + 'xdx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
293 s = s + 'xex'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
294
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
295 s = s + 'xax'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
296 s = s + 'xbx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
297 s = s + 'xcx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
298 s = s + 'xdx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
299 s = s + 'xex'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
300
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
301 s = s + 'xax'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
302 s = s + 'xbx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
303 s = s + 'xcx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
304 s = s + 'xdx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
305 s = s + 'xex'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
306
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
307 s = s + 'xax'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
308 s = s + 'xbx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
309 s = s + 'xcx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
310 s = s + 'xdx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
311 s = s + 'xex'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
312
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
313 s = s + 'xax'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
314 s = s + 'xbx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
315 s = s + 'xcx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
316 s = s + 'xdx'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
317 s = s + 'xex'
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
318
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
319 def calibrate(self):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
320
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
321 for i in xrange(self.rounds):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
322 pass
37903
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
323
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
324
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
325 class StringSlicing(Test):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
326
38801
2167105123e4 Updated to pybench 2.0.
Marc-André Lemburg <mal@egenix.com>
parents: 38392
diff changeset
327 version = 2.0
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
328 operations = 5 * 7
38801
2167105123e4 Updated to pybench 2.0.
Marc-André Lemburg <mal@egenix.com>
parents: 38392
diff changeset
329 rounds = 160000
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
330
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
331 def test(self):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
332
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
333 s = join(map(str,range(100)))
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
334
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
335 for i in xrange(self.rounds):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
336
37903
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
337 s[50:]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
338 s[:25]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
339 s[50:55]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
340 s[-1:]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
341 s[:1]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
342 s[2:]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
343 s[11:-11]
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
344
37903
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
345 s[50:]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
346 s[:25]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
347 s[50:55]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
348 s[-1:]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
349 s[:1]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
350 s[2:]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
351 s[11:-11]
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
352
37903
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
353 s[50:]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
354 s[:25]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
355 s[50:55]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
356 s[-1:]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
357 s[:1]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
358 s[2:]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
359 s[11:-11]
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
360
37903
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
361 s[50:]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
362 s[:25]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
363 s[50:55]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
364 s[-1:]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
365 s[:1]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
366 s[2:]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
367 s[11:-11]
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
368
37903
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
369 s[50:]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
370 s[:25]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
371 s[50:55]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
372 s[-1:]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
373 s[:1]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
374 s[2:]
56089faba056 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37857
diff changeset
375 s[11:-11]
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
376
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
377 def calibrate(self):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
378
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
379 s = join(map(str,range(100)))
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
380
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
381 for i in xrange(self.rounds):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
382 pass
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
383
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
384 ### String methods
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
385
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
386 if hasattr('', 'lower'):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
387
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
388 class StringMappings(Test):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
389
38801
2167105123e4 Updated to pybench 2.0.
Marc-André Lemburg <mal@egenix.com>
parents: 38392
diff changeset
390 version = 2.0
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
391 operations = 3 * (5 + 4 + 2 + 1)
38392
816f8e60097a Revert tests to MAL's original round sizes to retiain comparability
Steve Holden <steve@holdenweb.com>
parents: 38375
diff changeset
392 rounds = 70000
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
393
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
394 def test(self):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
395
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
396 s = join(map(chr,range(20)),'')
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
397 t = join(map(chr,range(50)),'')
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
398 u = join(map(chr,range(100)),'')
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
399 v = join(map(chr,range(256)),'')
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
400
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
401 for i in xrange(self.rounds):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
402
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
403 s.lower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
404 s.lower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
405 s.lower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
406 s.lower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
407 s.lower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
408
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
409 s.upper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
410 s.upper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
411 s.upper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
412 s.upper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
413 s.upper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
414
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
415 s.title()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
416 s.title()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
417 s.title()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
418 s.title()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
419 s.title()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
420
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
421 t.lower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
422 t.lower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
423 t.lower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
424 t.lower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
425
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
426 t.upper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
427 t.upper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
428 t.upper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
429 t.upper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
430
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
431 t.title()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
432 t.title()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
433 t.title()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
434 t.title()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
435
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
436 u.lower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
437 u.lower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
438
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
439 u.upper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
440 u.upper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
441
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
442 u.title()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
443 u.title()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
444
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
445 v.lower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
446
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
447 v.upper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
448
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
449 v.title()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
450
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
451 def calibrate(self):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
452
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
453 s = join(map(chr,range(20)),'')
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
454 t = join(map(chr,range(50)),'')
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
455 u = join(map(chr,range(100)),'')
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
456 v = join(map(chr,range(256)),'')
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
457
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
458 for i in xrange(self.rounds):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
459 pass
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
460
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
461 class StringPredicates(Test):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
462
38801
2167105123e4 Updated to pybench 2.0.
Marc-André Lemburg <mal@egenix.com>
parents: 38392
diff changeset
463 version = 2.0
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
464 operations = 10 * 7
38801
2167105123e4 Updated to pybench 2.0.
Marc-André Lemburg <mal@egenix.com>
parents: 38392
diff changeset
465 rounds = 100000
37857
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
466
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
467 def test(self):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
468
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
469 data = ('abc', '123', ' ', '\xe4\xf6\xfc', '\xdf'*10)
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
470 len_data = len(data)
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
471
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
472 for i in xrange(self.rounds):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
473 s = data[i % len_data]
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
474
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
475 s.isalnum()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
476 s.isalpha()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
477 s.isdigit()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
478 s.islower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
479 s.isspace()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
480 s.istitle()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
481 s.isupper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
482
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
483 s.isalnum()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
484 s.isalpha()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
485 s.isdigit()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
486 s.islower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
487 s.isspace()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
488 s.istitle()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
489 s.isupper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
490
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
491 s.isalnum()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
492 s.isalpha()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
493 s.isdigit()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
494 s.islower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
495 s.isspace()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
496 s.istitle()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
497 s.isupper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
498
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
499 s.isalnum()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
500 s.isalpha()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
501 s.isdigit()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
502 s.islower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
503 s.isspace()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
504 s.istitle()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
505 s.isupper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
506
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
507 s.isalnum()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
508 s.isalpha()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
509 s.isdigit()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
510 s.islower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
511 s.isspace()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
512 s.istitle()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
513 s.isupper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
514
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
515 s.isalnum()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
516 s.isalpha()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
517 s.isdigit()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
518 s.islower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
519 s.isspace()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
520 s.istitle()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
521 s.isupper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
522
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
523 s.isalnum()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
524 s.isalpha()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
525 s.isdigit()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
526 s.islower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
527 s.isspace()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
528 s.istitle()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
529 s.isupper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
530
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
531 s.isalnum()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
532 s.isalpha()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
533 s.isdigit()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
534 s.islower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
535 s.isspace()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
536 s.istitle()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
537 s.isupper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
538
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
539 s.isalnum()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
540 s.isalpha()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
541 s.isdigit()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
542 s.islower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
543 s.isspace()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
544 s.istitle()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
545 s.isupper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
546
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
547 s.isalnum()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
548 s.isalpha()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
549 s.isdigit()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
550 s.islower()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
551 s.isspace()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
552 s.istitle()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
553 s.isupper()
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
554
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
555 def calibrate(self):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
556
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
557 data = ('abc', '123', ' ', '\u1234\u2345\u3456', '\uFFFF'*10)
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
558 data = ('abc', '123', ' ', '\xe4\xf6\xfc', '\xdf'*10)
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
559 len_data = len(data)
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
560
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
561 for i in xrange(self.rounds):
a4d5cefc2de4 Adding pybench 1.3 to the Tools/ directory.
Marc-André Lemburg <mal@egenix.com>
parents:
diff changeset
562 s = data[i % len_data]