/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-08 03:34:57 UTC
  • mto: This revision was merged to the branch mainline in revision 1937.
  • Revision ID: john@arbash-meinel.com-20060808033457-406d62b14bedabe8
Some small tweaks to knit and tuned_gzip to shave off another couple seconds

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2006 by 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 version 2 as published by
 
5
# the Free Software Foundation.
 
6
#
 
7
# This program is distributed in the hope that it will be useful,
 
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
# GNU General Public License for more details.
 
11
#
 
12
# You should have received a copy of the GNU General Public License
 
13
# along with this program; if not, write to the Free Software
 
14
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
 
 
16
"""Tests for bzr benchmark utilities performance."""
 
17
 
 
18
from bzrlib import (
 
19
    osutils,
 
20
    )
 
21
from bzrlib.benchmarks import Benchmark
 
22
 
 
23
 
 
24
class MakeKernelLikeTreeBenchmark(Benchmark):
 
25
 
 
26
    def test_01_make_kernel_like_tree(self):
 
27
        """Making a kernel sized tree should be ~ 5seconds on modern disk.""" 
 
28
        # on roberts machine: this originally took:  7372ms/ 7479ms
 
29
        # with the LocalTransport._abspath call:     3730ms/ 3778ms
 
30
        self.time(self.make_kernel_like_tree)
 
31
 
 
32
    def test_02_make_kernel_like_tree(self):
 
33
        """Hardlinking a kernel-like working tree should be ~1s"""
 
34
        # 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)
 
38
 
 
39
    def test_03_make_kernel_like_added_tree(self):
 
40
        """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
 
49
 
 
50
    def test_04_make_kernel_like_added_tree(self):
 
51
        """Time the second creation of a kernel like added tree 
 
52
        (this should be a clone)
 
53
        """
 
54
        # 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')
 
57
 
 
58
    def test_05_make_kernel_like_committed_tree(self):
 
59
        """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
 
68
 
 
69
    def test_06_make_kernel_like_committed_tree(self):
 
70
        """Time the second creation of a committed kernel like tree 
 
71
        (this should be a clone)
 
72
        """
 
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')
 
76
 
 
77
    def test_07_make_kernel_like_committed_tree_hardlink(self):
 
78
        """Time the creation of a committed kernel like tree 
 
79
        (this should also hardlink the .bzr/ directory)
 
80
        """
 
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)
 
85
 
 
86