/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to tools/weavebench.py

  • Committer: Martin Pool
  • Date: 2005-07-18 09:30:37 UTC
  • Revision ID: mbp@sourcefrog.net-20050718093037-c6eb37d3468cb809
- more diff TODOs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /usr/bin/python
2
2
 
3
3
# Copyright (C) 2005 Canonical Ltd
4
 
#
 
4
 
5
5
# This program is free software; you can redistribute it and/or modify
6
6
# it under the terms of the GNU General Public License as published by
7
7
# the Free Software Foundation; either version 2 of the License, or
8
8
# (at your option) any later version.
9
 
#
 
9
 
10
10
# This program is distributed in the hope that it will be useful,
11
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
13
# GNU General Public License for more details.
14
 
#
 
14
 
15
15
# You should have received a copy of the GNU General Public License
16
16
# along with this program; if not, write to the Free Software
17
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
18
 
19
19
 
20
20
"""Weave algorithms benchmark"""
23
23
from bzrlib.weave import Weave
24
24
from bzrlib.weavefile import write_weave
25
25
from bzrlib.progress import ProgressBar
26
 
from random import randrange, randint, seed
 
26
from random import randrange, randint
27
27
import tempfile
28
28
import hotshot, hotshot.stats
29
29
import sys
31
31
WEAVE_NAME = "bench.weave"
32
32
NUM_REVS = 2000
33
33
 
34
 
seed(0)
35
 
 
36
34
def build():
37
35
    pb = ProgressBar(show_eta=False)
38
36
 
51
49
            if lines:
52
50
                del lines[randrange(0, len(lines))]
53
51
 
54
 
        rev_id = wf.add("%s" % i, parents, lines)
 
52
        rev_id = wf.add(parents, lines)
55
53
        parents = [rev_id]
56
54
 
57
55
    write_weave(wf, file(WEAVE_NAME, 'wb'))