~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-11-28 16:00:17 UTC
  • mto: This revision was merged to the branch mainline in revision 2153.
  • Revision ID: john@arbash-meinel.com-20061128160017-cac6j7952jlersoe
(Dmitry Vasiliev) Update and improve benchmarks for cache_utf8

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
 
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)
112
112
 
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)
118
118
 
 
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)
 
122
 
 
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)
 
126
 
 
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)
 
131
 
 
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)
119
136
 
120
137
class DecodingBenchmarks(Benchmark):
121
138
 
173
190
 
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)
180
197
 
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)
 
204
 
 
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)
 
208
 
 
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)
 
212
 
 
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)
 
218
 
 
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)