/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 bzrlib/benchmarks/bench_startup.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-18 18:18:36 UTC
  • mto: This revision was merged to the branch mainline in revision 4461.
  • Revision ID: john@arbash-meinel.com-20090618181836-biodfkat9a8eyzjz
The new add_inventory_by_delta is returning a CHKInventory when mapping from NULL
Which is completely valid, but 'broke' one of the tests.
So to fix it, changed the test to use CHKInventories on both sides, and add an __eq__
member. The nice thing is that CHKInventory.__eq__ is fairly cheap, since it only
has to check the root keys.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2006 Canonical Ltd
 
2
#
 
3
# This program is free software; you can redistribute it and/or modify
 
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.
 
7
#
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
16
 
 
17
"""Benchmarks of bzr startup time, for some simple operations."""
 
18
 
 
19
 
 
20
from bzrlib.benchmarks import Benchmark
 
21
 
 
22
 
 
23
class StartupBenchmark(Benchmark):
 
24
    """Benchmark startup costs for certain bzr commands."""
 
25
 
 
26
    def make_simple_tree(self):
 
27
        """A small, simple tree. No caching needed"""
 
28
        tree = self.make_branch_and_tree('.')
 
29
        self.build_tree(['a', 'b/', 'b/c'])
 
30
        tree.add(['a', 'b', 'b/c'])
 
31
        return tree
 
32
 
 
33
    def make_simple_committed_tree(self):
 
34
        tree = self.make_simple_tree()
 
35
        tree.commit('simple commit')
 
36
        return tree
 
37
 
 
38
    def test___version(self):
 
39
        """Test the startup overhead of plain bzr --version"""
 
40
        self.time(self.run_bzr_subprocess, '--version')
 
41
 
 
42
    def test_branch(self):
 
43
        """Test the time to branch this into other"""
 
44
        tree = self.make_simple_committed_tree()
 
45
        self.time(self.run_bzr_subprocess, 'branch', '.', 'other')
 
46
 
 
47
    def test_commit(self):
 
48
        """Test execution of simple commit"""
 
49
        tree = self.make_simple_tree()
 
50
        self.time(self.run_bzr_subprocess, 'commit', '-m', 'init simple tree')
 
51
 
 
52
    def test_diff(self):
 
53
        """Test simple diff time"""
 
54
        tree = self.make_simple_committed_tree()
 
55
        self.time(self.run_bzr_subprocess, 'diff')
 
56
 
 
57
    def test_help(self):
 
58
        """Test the startup overhead of plain bzr help"""
 
59
        self.time(self.run_bzr_subprocess, 'help')
 
60
 
 
61
    def test_help_commands(self):
 
62
        """startup time for bzr help commands, which has to load more"""
 
63
        self.time(self.run_bzr_subprocess, 'help', 'commands')
 
64
 
 
65
    def test_log(self):
 
66
        """Test simple log time"""
 
67
        tree = self.make_simple_committed_tree()
 
68
        self.time(self.run_bzr_subprocess, 'log')
 
69
 
 
70
    def test_missing(self):
 
71
        """Test simple missing time"""
 
72
        tree = self.make_simple_committed_tree()
 
73
        other = tree.bzrdir.sprout('other')
 
74
        self.time(self.run_bzr_subprocess, 'missing', working_dir='other')
 
75
 
 
76
    def test_pull(self):
 
77
        """Test simple pull time"""
 
78
        tree = self.make_simple_committed_tree()
 
79
        other = tree.bzrdir.sprout('other')
 
80
        # There should be nothing to pull, and this should be determined
 
81
        # quickly
 
82
        self.time(self.run_bzr_subprocess, 'pull', working_dir='other')
 
83
 
 
84
    def test_rocks(self):
 
85
        """Test the startup overhead by running a do-nothing command"""
 
86
        self.time(self.run_bzr_subprocess, 'rocks')
 
87
 
 
88
    def test_status(self):
 
89
        """Test simple status time"""
 
90
        tree = self.make_simple_committed_tree()
 
91
        self.time(self.run_bzr_subprocess, 'status')