benchmark selftests

Robert Collins robertc at
Thu May 18 08:43:31 BST 2006

Martin and I have revamped the benchmarking test suite concept, we pair
programmed a small an fairly elegant tool to let us have benchmarks.

I'm merging it into now (it has two +1's :)).

To use it, just do 'bzr selftest --benchmark -v'. We probably should
make -v default to on.

This will run the benchmarks and report how long they take. Our first
one is for 'add'. In the output there are two numbers:

This lets you write (for instance) a benchmark that tests the
performance of commit on 10K files without it being conflated with the
performance of add on 10K files.

To make something in a benchmark test accrue time to the benchmarked
operations counter, run it via self.time.

I.e. "self.time(self.run_bzr, 'add')" will run self.run_bzr('add') and
have that timed.

The time is not reentrant safe: if you time a routine that times things,
the time will be added twice. The intent is that the operations being
timed should always be in the benchmark test itself, for clarity of what
is being tested, so this should not be a significant issue.

GPG key available at: <>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : 

More information about the bazaar mailing list