~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/benchmarks/bench_workingtree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-07-27 06:15:32 UTC
  • mfrom: (2617.5.10 win32_glob)
  • Revision ID: pqm@pqm.ubuntu.com-20070727061532-14ly852y2g2dbcb8
(Kuno Meyer) Tests for glob expansions on win32 + bugfix for `bzr
 add *` when non-ascii filenames are in working tree (#127361) (r=aaron,r=bialix)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
 
26
26
class WorkingTreeBenchmark(Benchmark):
 
27
    """Benchmarks for `bzrlib.workingtree` performance."""
27
28
 
28
29
    def test_list_files_kernel_like_tree(self):
29
30
        tree = self.make_kernel_like_added_tree()
30
 
        self.time(list, tree.list_files())
 
31
        tree.lock_read()
 
32
        try:
 
33
            self.time(list, tree.list_files())
 
34
        finally:
 
35
            tree.unlock()
31
36
 
32
37
    def test_list_files_unknown_kernel_like_tree(self):
33
38
        tree = self.make_kernel_like_tree(link_working=True)
41
46
            if root == '.':
42
47
                continue
43
48
            tree.add(root)
44
 
        self.time(list, tree.list_files())
 
49
        tree.lock_read()
 
50
        try:
 
51
            self.time(list, tree.list_files())
 
52
        finally:
 
53
            tree.unlock()
45
54
 
46
55
    def test_is_ignored_single_call(self):
47
56
        """How long does is_ignored take to initialise and check one file."""
84
93
        self.time(t.is_ignored,'bar')
85
94
        ignores._runtime_ignores = set()
86
95
 
 
96
    def test_walkdirs_kernel_like_tree(self):
 
97
        """Walking a kernel sized tree is fast!(150ms)."""
 
98
        self.make_kernel_like_tree()
 
99
        self.run_bzr('add')
 
100
        tree = WorkingTree.open('.')
 
101
        # on roberts machine: this originally took:  157ms/4177ms
 
102
        # plain os.walk takes 213ms on this tree
 
103
        self.time(list, tree.walkdirs())
87
104
 
 
105
    def test_walkdirs_kernel_like_tree_unknown(self):
 
106
        """Walking a kernel sized tree is fast!(150ms)."""
 
107
        self.make_kernel_like_tree()
 
108
        tree = WorkingTree.open('.')
 
109
        # on roberts machine: this originally took:  157ms/4177ms
 
110
        # plain os.walk takes 213ms on this tree
 
111
        self.time(list, tree.walkdirs())