107
107
def test_encode_1k_by_1k_unicode(self):
108
108
"""Test encoding 5 revisions 100k times"""
109
revisions = ['\u062c\u0648\u062c\u0648' +
109
revisions = [u'\u062c\u0648\u062c\u0648' +
110
110
unicode(osutils.rand_chars(60)) for x in xrange(1000)]
111
111
self.time(self.encode_multi, revisions, 1000)
113
113
def test_encode_1k_by_1k_unicode_cached(self):
114
114
"""Test encoding 5 revisions 100k times"""
115
revisions = ['\u062c\u0648\u062c\u0648' +
115
revisions = [u'\u062c\u0648\u062c\u0648' +
116
116
unicode(osutils.rand_chars(60)) for x in xrange(1000)]
117
117
self.time(self.encode_cached_multi, revisions, 1000)
119
def test_encode_500K_by_1_ascii(self):
120
revisions = [unicode("test%07d" % x) for x in xrange(500000)]
121
self.time(self.encode_multi, revisions, 1)
123
def test_encode_500K_by_1_ascii_cached(self):
124
revisions = [unicode("test%07d" % x) for x in xrange(500000)]
125
self.time(self.encode_cached_multi, revisions, 1)
127
def test_encode_500K_by_1_unicode(self):
128
revisions = [u'\u062c\u0648\u062c\u0648' +
129
unicode("%07d" % x) for x in xrange(500000)]
130
self.time(self.encode_multi, revisions, 1)
132
def test_encode_500K_by_1_unicode_cached(self):
133
revisions = [u'\u062c\u0648\u062c\u0648' +
134
unicode("%07d" % x) for x in xrange(500000)]
135
self.time(self.encode_cached_multi, revisions, 1)
120
137
class DecodingBenchmarks(Benchmark):
174
191
def test_decode_1k_by_1k_unicode(self):
175
192
"""Test decoding 5 revisions 100k times"""
176
revisions = [('\u062c\u0648\u062c\u0648' +
193
revisions = [(u'\u062c\u0648\u062c\u0648' +
177
194
unicode(osutils.rand_chars(60))).encode('utf8')
178
195
for x in xrange(1000)]
179
196
self.time(self.decode_multi, revisions, 1000)
181
198
def test_decode_1k_by_1k_unicode_cached(self):
182
199
"""Test decoding 5 revisions 100k times"""
183
revisions = [('\u062c\u0648\u062c\u0648' +
200
revisions = [(u'\u062c\u0648\u062c\u0648' +
184
201
unicode(osutils.rand_chars(60))).encode('utf8')
185
202
for x in xrange(1000)]
186
203
self.time(self.decode_cached_multi, revisions, 1000)
205
def test_decode_500K_by_1_ascii(self):
206
revisions = [("test%07d" % x) for x in xrange(500000)]
207
self.time(self.decode_multi, revisions, 1)
209
def test_decode_500K_by_1_ascii_cached(self):
210
revisions = [("test%07d" % x) for x in xrange(500000)]
211
self.time(self.decode_cached_multi, revisions, 1)
213
def test_decode_500K_by_1_unicode(self):
214
revisions = [(u'\u062c\u0648\u062c\u0648' +
215
unicode("%07d" % x)).encode('utf-8')
216
for x in xrange(500000)]
217
self.time(self.decode_multi, revisions, 1)
219
def test_decode_500K_by_1_unicode_cached(self):
220
revisions = [(u'\u062c\u0648\u062c\u0648' +
221
unicode("%07d" % x)).encode('utf-8')
222
for x in xrange(500000)]
223
self.time(self.decode_cached_multi, revisions, 1)