[RFC] test optimisations

Robert Collins robertc at robertcollins.net
Thu Sep 14 07:05:26 BST 2006


So I'm continuing as a background task to tune the test suite. I'm
seeing a 25% increase at the moment as I go.

It seems to be shaping up as follows:

 1) tests that never need disk resources: a tree is only used to setup
the test.
   -> MemoryTree + a branch & repo on a MemoryTransport is ideal.

 2) tests that test behaviour with a tree where the behaviour is not
tree-format specific: disk access is needed for that, but not for the
branch and repository.
    -> WorkingTree + BranchReference on disk, + a branch & repo on a
MemoryTransport is ideal.
 
 3) tests that test behaviour on tree formats:
  - format specific WorkingTree is needed, and we cannot use
BranchReferences because not all trees will work with them. In this case
I think the overhead of getting 'best' performance would harm clarity
because of the complexity of cloning some things locally and some
remotely. I'm not planning to use MemoryTransport for these cases.

 4) tests that test bzrdir/repository/branch formats. here I think that
some formats will work off memory, and some wont. We have:
git/hg/svn/bzr-all-in-one are disk backed only; metadir and remote*
operate on disk or memory equally happily.
  I think it would be nice for these tests to eventually use memory when
possible, and fallback to using disk for formats that require it.
 
 5) InterFOO tests, where FOO is branch/repository/bzrdir - these should
follow the same rules as the bzrdir/repository/branch format tests.

What I'm planning on doing is:
 * Creating a subclass of TestCase between TestCase and
TestCaseWithTemporaryDirectory, and lifting up to that all the methods
needed to make tests that I encounter in group 1) pass. This will mean
that they no longer require any disk operations at all - no mkdir,
nothing. They will just chdir to the test suite root dir. The default
transport at this level will be a MemoryTransport, and will not be
affected by the command line --transport option. (Because, to honour the
transport will require making a directory always, or hairy conditional
code)

 * Adding a new helper method on TestCaseWithTransport for 2) which will
create the branch and repo on a memory transport (so they need a default
branch format that is memorytransport compatible) and always make a
branch reference and working tree on disk. This will probably honour the
--transport option if it has been set.

 * Branch format etc already have a transport parameter (in the merge
pipeline for the high performance server). When that lands, I'll make
sure the convenience method for 2) also works for these tests, using the
transport, and change the default for these tests to be MemoryTransport.
For the smart server instances, this will change the servers backing
transport rather than the one the branch etc are made on.

Does this sound reasonable ?

Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- 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 : https://lists.ubuntu.com/archives/bazaar/attachments/20060914/85ec377d/attachment.pgp 


More information about the bazaar mailing list