~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/benchmarks/bench_cache_utf8.py

  • Committer: Vincent Ladeuil
  • Date: 2007-06-05 15:52:12 UTC
  • mto: (2485.8.44 bzr.connection.sharing)
  • mto: This revision was merged to the branch mainline in revision 2646.
  • Revision ID: v.ladeuil+lp@free.fr-20070605155212-k2za98dhobeikxhn
Fix pull multiple connections.

* bzrlib/builtins.py:
(cmd_pull.run): If 'location' wasn't a bundle, the transport may
be reused.

* bzrlib/branch.py:
(Branch.open_from_transport): New method.

* bzrlib/bundle/__init__.py:
(read_mergeable_from_transport): New method.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 by Canonical Ltd
 
1
# Copyright (C) 2006 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
 
# it under the terms of the GNU General Public License version 2 as published by
5
 
# the Free Software Foundation.
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
6
7
#
7
8
# This program is distributed in the hope that it will be useful,
8
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
14
# along with this program; if not, write to the Free Software
14
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
15
16
 
 
17
 
16
18
"""Tests for encoding performance."""
17
19
 
18
20
from bzrlib import (
104
106
 
105
107
    def test_encode_1k_by_1k_unicode(self):
106
108
        """Test encoding 5 revisions 100k times"""
107
 
        revisions = ['\u062c\u0648\u062c\u0648' +
 
109
        revisions = [u'\u062c\u0648\u062c\u0648' +
108
110
                     unicode(osutils.rand_chars(60)) for x in xrange(1000)]
109
111
        self.time(self.encode_multi, revisions, 1000)
110
112
 
111
113
    def test_encode_1k_by_1k_unicode_cached(self):
112
114
        """Test encoding 5 revisions 100k times"""
113
 
        revisions = ['\u062c\u0648\u062c\u0648' +
 
115
        revisions = [u'\u062c\u0648\u062c\u0648' +
114
116
                     unicode(osutils.rand_chars(60)) for x in xrange(1000)]
115
117
        self.time(self.encode_cached_multi, revisions, 1000)
116
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)
117
136
 
118
137
class DecodingBenchmarks(Benchmark):
119
138
 
171
190
 
172
191
    def test_decode_1k_by_1k_unicode(self):
173
192
        """Test decoding 5 revisions 100k times"""
174
 
        revisions = [('\u062c\u0648\u062c\u0648' +
 
193
        revisions = [(u'\u062c\u0648\u062c\u0648' +
175
194
                      unicode(osutils.rand_chars(60))).encode('utf8')
176
195
                     for x in xrange(1000)]
177
196
        self.time(self.decode_multi, revisions, 1000)
178
197
 
179
198
    def test_decode_1k_by_1k_unicode_cached(self):
180
199
        """Test decoding 5 revisions 100k times"""
181
 
        revisions = [('\u062c\u0648\u062c\u0648' +
 
200
        revisions = [(u'\u062c\u0648\u062c\u0648' +
182
201
                      unicode(osutils.rand_chars(60))).encode('utf8')
183
202
                     for x in xrange(1000)]
184
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)