/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_bench.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-16 18:38:57 UTC
  • mfrom: (1934 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1937.
  • Revision ID: john@arbash-meinel.com-20060816183857-7307edffa7098bd2
[merge] bzr.dev 1934

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
    osutils,
20
20
    )
21
21
from bzrlib.benchmarks import Benchmark
 
22
from bzrlib.benchmarks.tree_creator.kernel_like import (
 
23
    KernelLikeTreeCreator,
 
24
    KernelLikeAddedTreeCreator,
 
25
    KernelLikeCommittedTreeCreator,
 
26
    )
 
27
from bzrlib.tests import TestSkipped
22
28
 
23
29
 
24
30
class MakeKernelLikeTreeBenchmark(Benchmark):
25
31
 
26
 
    def test_01_make_kernel_like_tree(self):
 
32
    def test_make_kernel_like_tree(self):
27
33
        """Making a kernel sized tree should be ~ 5seconds on modern disk.""" 
28
34
        # on roberts machine: this originally took:  7372ms/ 7479ms
29
35
        # with the LocalTransport._abspath call:     3730ms/ 3778ms
 
36
        # with AtomicFile tuning:                    2888ms/ 2926ms
 
37
        # switching to transport.append:             1468ms/ 2849ms
30
38
        self.time(self.make_kernel_like_tree)
31
39
 
32
40
    def test_02_make_kernel_like_tree(self):
33
41
        """Hardlinking a kernel-like working tree should be ~1s"""
34
42
        # make sure kernel_like_tree is cached
35
 
        self._cache_kernel_like_tree()
36
 
        self.time(self.make_kernel_like_tree, root='bar',
37
 
                  hardlink_working=True)
 
43
        creator = KernelLikeTreeCreator(self, link_working=True)
 
44
        if not creator.is_caching_enabled():
 
45
            raise TestSkipped('caching is disabled')
 
46
        creator.ensure_cached()
 
47
        self.time(creator.create, root='bar')
38
48
 
39
49
    def test_03_make_kernel_like_added_tree(self):
40
50
        """Time the first creation of a kernel like added tree"""
41
 
        orig_cache = Benchmark.CACHE_ROOT
42
 
        try:
43
 
            # Change to a local cache directory so we know this
44
 
            # really creates the files
45
 
            Benchmark.CACHE_ROOT = osutils.abspath('cache')
46
 
            self.time(self.make_kernel_like_added_tree, root='foo')
47
 
        finally:
48
 
            Benchmark.CACHE_ROOT = orig_cache
 
51
        creator = KernelLikeAddedTreeCreator(self)
 
52
        creator.disable_cache()
 
53
        self.time(creator.create, root='foo')
49
54
 
50
55
    def test_04_make_kernel_like_added_tree(self):
51
56
        """Time the second creation of a kernel like added tree 
52
57
        (this should be a clone)
53
58
        """
54
59
        # make sure kernel_like_added_tree is cached
55
 
        self._cache_kernel_like_added_tree()
56
 
        self.time(self.make_kernel_like_added_tree, root='bar')
 
60
        creator = KernelLikeAddedTreeCreator(self, link_working=True)
 
61
        if not creator.is_caching_enabled():
 
62
            # Caching is disabled, this test is meaningless
 
63
            raise TestSkipped('caching is disabled')
 
64
        creator.ensure_cached()
 
65
        self.time(creator.create, root='bar')
57
66
 
58
67
    def test_05_make_kernel_like_committed_tree(self):
59
68
        """Time the first creation of a committed kernel like tree"""
60
 
        orig_cache = Benchmark.CACHE_ROOT
61
 
        try:
62
 
            # Change to a local cache directory so we know this
63
 
            # really creates the files
64
 
            Benchmark.CACHE_ROOT = osutils.abspath('cache')
65
 
            self.time(self.make_kernel_like_committed_tree, root='foo')
66
 
        finally:
67
 
            Benchmark.CACHE_ROOT = orig_cache
 
69
        creator = KernelLikeCommittedTreeCreator(self)
 
70
        creator.disable_cache()
 
71
        self.time(creator.create, root='foo')
68
72
 
69
73
    def test_06_make_kernel_like_committed_tree(self):
70
74
        """Time the second creation of a committed kernel like tree 
71
75
        (this should be a clone)
72
76
        """
73
 
        # Call make_kernel_like_committed_tree to make sure it is cached
74
 
        self._cache_kernel_like_committed_tree()
75
 
        self.time(self.make_kernel_like_committed_tree, root='bar')
 
77
        creator = KernelLikeCommittedTreeCreator(self,
 
78
                                                 link_working=True,
 
79
                                                 link_bzr=False)
 
80
        if not creator.is_caching_enabled():
 
81
            # Caching is disabled, this test is meaningless
 
82
            raise TestSkipped('caching is disabled')
 
83
        creator.ensure_cached()
 
84
        self.time(creator.create, root='bar')
76
85
 
77
86
    def test_07_make_kernel_like_committed_tree_hardlink(self):
78
87
        """Time the creation of a committed kernel like tree 
79
88
        (this should also hardlink the .bzr/ directory)
80
89
        """
81
 
        # make sure kernel_like_committed_tree is cached
82
 
        self._cache_kernel_like_committed_tree()
83
 
        self.time(self.make_kernel_like_committed_tree, root='bar',
84
 
                    hardlink_bzr=True)
 
90
        creator = KernelLikeCommittedTreeCreator(self,
 
91
                                                 link_working=True,
 
92
                                                 link_bzr=True)
 
93
        if not creator.is_caching_enabled():
 
94
            # Caching is disabled, this test is meaningless
 
95
            raise TestSkipped('caching is disabled')
 
96
        creator.ensure_cached()
 
97
        self.time(creator.create, root='bar')
85
98
 
86
99