108
107
def test_encode_1k_by_1k_unicode(self):
109
108
"""Test encoding 5 revisions 100k times"""
110
revisions = [u'\u062c\u0648\u062c\u0648' +
109
revisions = ['\u062c\u0648\u062c\u0648' +
111
110
unicode(osutils.rand_chars(60)) for x in xrange(1000)]
112
111
self.time(self.encode_multi, revisions, 1000)
114
113
def test_encode_1k_by_1k_unicode_cached(self):
115
114
"""Test encoding 5 revisions 100k times"""
116
revisions = [u'\u062c\u0648\u062c\u0648' +
115
revisions = ['\u062c\u0648\u062c\u0648' +
117
116
unicode(osutils.rand_chars(60)) for x in xrange(1000)]
118
117
self.time(self.encode_cached_multi, revisions, 1000)
120
def test_encode_500K_by_1_ascii(self):
121
revisions = [unicode("test%07d" % x) for x in xrange(500000)]
122
self.time(self.encode_multi, revisions, 1)
124
def test_encode_500K_by_1_ascii_cached(self):
125
revisions = [unicode("test%07d" % x) for x in xrange(500000)]
126
self.time(self.encode_cached_multi, revisions, 1)
128
def test_encode_500K_by_1_unicode(self):
129
revisions = [u'\u062c\u0648\u062c\u0648' +
130
unicode("%07d" % x) for x in xrange(500000)]
131
self.time(self.encode_multi, revisions, 1)
133
def test_encode_500K_by_1_unicode_cached(self):
134
revisions = [u'\u062c\u0648\u062c\u0648' +
135
unicode("%07d" % x) for x in xrange(500000)]
136
self.time(self.encode_cached_multi, revisions, 1)
139
120
class DecodingBenchmarks(Benchmark):
140
"""Benchmark the time to decode strings."""
143
123
super(DecodingBenchmarks, self).setUp()
194
174
def test_decode_1k_by_1k_unicode(self):
195
175
"""Test decoding 5 revisions 100k times"""
196
revisions = [(u'\u062c\u0648\u062c\u0648' +
176
revisions = [('\u062c\u0648\u062c\u0648' +
197
177
unicode(osutils.rand_chars(60))).encode('utf8')
198
178
for x in xrange(1000)]
199
179
self.time(self.decode_multi, revisions, 1000)
201
181
def test_decode_1k_by_1k_unicode_cached(self):
202
182
"""Test decoding 5 revisions 100k times"""
203
revisions = [(u'\u062c\u0648\u062c\u0648' +
183
revisions = [('\u062c\u0648\u062c\u0648' +
204
184
unicode(osutils.rand_chars(60))).encode('utf8')
205
185
for x in xrange(1000)]
206
186
self.time(self.decode_cached_multi, revisions, 1000)
208
def test_decode_500K_by_1_ascii(self):
209
revisions = [("test%07d" % x) for x in xrange(500000)]
210
self.time(self.decode_multi, revisions, 1)
212
def test_decode_500K_by_1_ascii_cached(self):
213
revisions = [("test%07d" % x) for x in xrange(500000)]
214
self.time(self.decode_cached_multi, revisions, 1)
216
def test_decode_500K_by_1_unicode(self):
217
revisions = [(u'\u062c\u0648\u062c\u0648' +
218
unicode("%07d" % x)).encode('utf-8')
219
for x in xrange(500000)]
220
self.time(self.decode_multi, revisions, 1)
222
def test_decode_500K_by_1_unicode_cached(self):
223
revisions = [(u'\u062c\u0648\u062c\u0648' +
224
unicode("%07d" % x)).encode('utf-8')
225
for x in xrange(500000)]
226
self.time(self.decode_cached_multi, revisions, 1)