[MERGE] more benchmarks
Martin Pool
mbp at canonical.com
Mon May 22 05:00:44 BST 2006
On 22 May 2006, Robert Collins <robertc at robertcollins.net> wrote:
> This adds benchmarks for 'bzr status' in a kernel like tree with added
> files and no ignored files, and 'bzr checkout --lightweight' of a kernel
> like tree.
+1, very welcome.
> === added file 'bzrlib/benchmarks/bench_checkout.py'
> +"""Tests for bzr tree building (checkout) performance."""
> +
> +
> +from bzrlib.benchmarks import Benchmark
> +
> +
> +class Checkout(Benchmark):
How about a convention that benchmark classes are called e.g.
'BenchCheckout' or 'CheckoutBenchmark'? (There seems some potential for
confusion in having one just called Checkout in the namespace.)
> +
> + def test_build_kernel_like_tree(self):
> + """Checkout of a clean kernel sized tree should be (<10secs)."""
> + self.make_kernel_tree()
> + self.run_bzr('add')
> + self.run_bzr('commit', '-m', 'first post')
> + # on robertc's machine the first sample of this took 105079ms/205417ms
> + self.time(self.run_bzr, 'checkout', '--lightweight', '.', 'acheckout')
>
> === added file 'bzrlib/benchmarks/bench_status.py'
> --- /dev/null
> +++ bzrlib/benchmarks/bench_status.py
> +from bzrlib.benchmarks import Benchmark
> +
> +
> +class Status(Benchmark):
> +
> + def test_clean_kernel_like_tree(self):
> + """Status in a clean kernel sized tree should be bearable (<2secs) fast."""
> + self.make_kernel_tree()
> + self.run_bzr('add')
> + # on robertc's machine the first sample of this took 1687ms/15994ms
> + self.time(self.run_bzr, 'status')
Hm, depends what you mean by 'clean' - I would have expected that meant
with no uncommitted changes.
>
> === modified file 'bzrlib/benchmarks/__init__.py'
> --- bzrlib/benchmarks/__init__.py
> +++ bzrlib/benchmarks/__init__.py
> @@ -18,11 +18,34 @@
> """Benchmark test suite for bzr."""
>
> from bzrlib.tests import TestLoader
> +from bzrlib.tests.blackbox import ExternalBase
> +
> +class Benchmark(ExternalBase):
> +
> + def make_kernel_tree(self):
> + """Setup a temporary tree roughly like a kernel tree."""
> + # a kernel tree has ~10000 and 500 directory, with most files around
> + # 3-4 levels deep.
> + # we simulate this by three levels of dirs named 0-7, givin 512 dirs,
> + # and 20 files each.
> + self.run_bzr('init')
> + files = []
> + for outer in range(8):
> + files.append("%s/" % outer)
> + for middle in range(8):
> + files.append("%s/%s/" % (outer, middle))
> + for inner in range(8):
> + prefix = "%s/%s/%s/" % (outer, middle, inner)
> + files.append(prefix)
> + files.extend([prefix + str(foo) for foo in range(20)])
> + self.build_tree(files)
Let's call it make_kernel_sized_tree or something, just for truth in
advertising.
> === modified file 'bzrlib/benchmarks/bench_add.py'
> --- bzrlib/benchmarks/bench_add.py
> +++ bzrlib/benchmarks/bench_add.py
> @@ -16,28 +16,14 @@
> """Tests for bzr add performance."""
>
>
> -from bzrlib.tests.blackbox import ExternalBase
> +from bzrlib.benchmarks import Benchmark
>
>
> -class TestAdd(ExternalBase):
> +class Add(Benchmark):
Similarly.
--
Martin
More information about the bazaar
mailing list