~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/benchmarks/bench_cache_utf8.py

  • Committer: John Arbash Meinel
  • Date: 2006-10-24 14:12:53 UTC
  • mto: This revision was merged to the branch mainline in revision 2095.
  • Revision ID: john@arbash-meinel.com-20061024141253-783fba812b197b70
(John Arbash Meinel) Update version information for 0.13 development

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
 
37
37
class EncodingBenchmark(Benchmark):
38
 
    """Benchmark the time to encode strings."""
39
38
 
40
39
    def setUp(self):
41
40
        super(EncodingBenchmark, self).setUp()
107
106
 
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)
113
112
 
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)
119
118
 
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)
123
 
 
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)
127
 
 
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)
132
 
 
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)
137
 
 
138
119
 
139
120
class DecodingBenchmarks(Benchmark):
140
 
    """Benchmark the time to decode strings."""
141
121
 
142
122
    def setUp(self):
143
123
        super(DecodingBenchmarks, self).setUp()
193
173
 
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)
200
180
 
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)
207
 
 
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)
211
 
 
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)
215
 
 
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)
221
 
 
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)