[off/2] question about TDD & benchmarking

John Arbash Meinel john at arbash-meinel.com
Fri Nov 24 17:12:57 GMT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alexander Belchenko wrote:
> My question something unrelated to bzr itself but it related to the style of bzr
> development.
> 
> First at all, I want to say 'big thanks' to Martin and others who steadily force
> bzr.dev community to use TDD for patches. I see how it helps in providing health
> and grow bzr codebase. Now, I'm also try to apply in my daily job elements of
> TDD where it possible and useful. And it's produce fantastic results!
> 
> I have my personal public project IntelHex (recently I register it on launchpad:
> http://launchpad.net/products/intelhex/). It have somewhat little user base,
> despite sometimes I receive patches for resolving some issues. I have test suite
> for my library and I try to use TDD as well.
> 
> Recently I receive patch with performance improvements on large files. Because
> bzr use benchmarking for testing such performance improvements, I'd like to add
> benchmark test for checking incoming patch.
> 
> Can someone give me a hints how to best do this? I'm not study yet benchmark
> subsystem of bzr.dev, I'd like to understand basic rules for writing benchmark
> tests.
> 
> Alexander
> 

You probably want to hear from Robert, since he was the one who wrote
it. But basically it amounts to something like:

1) Creating a base class (Benchmark) which derives from TestCase, and
provides a 'self.time()' function. That allows you to say what specific
function you are timing. It also provides a place that can be setup so
that 'bzr benchmark --lsprof-timed' can profile all of those places,
without profiling all the other startup code.

2) The rest is just a python test-suite, where all of the classes derive
from Benchmark, and use 'self.time()' to time a specific benchmark.

Also, the bzr codebase is GPL, so if your project is also GPL, you can
just copy and paste the code.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFZygZJdeBCYSNAAMRAnFUAJ0UXQ1aIWGZiHwOjnrvaif6ktkOhwCgsVH+
BbRNWrGh5ymr4hsBau5GZ0w=
=IjSH
-----END PGP SIGNATURE-----




More information about the bazaar mailing list