Performance testing of ignore changes?

John Arbash Meinel john at arbash-meinel.com
Mon Jan 4 19:07:26 GMT 2010


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

John Whitley wrote:
> Hi all,
> 
> I'm working on ignore exclusions[1] and would like to be able to do some
> performance tests to measure the impacts of the changes I'm making.  I didn't
> find much info on performance testing in the developer docs in bzr.dev.  I'd
> appreciate pointers, either to docs I missed, or suggestions for test approaches
> for this change.  FYI, the code in my working branch[2] works and has new tests,
> but isn't yet complete.  Feel free to look around the branch and comment here or
> directly to me via email.

I commonly use tools like "python -m timeit" to do performance testing.
I use this alias:

alias TIMEIT="/cygdrive/C/Python26/python -m timeit -s 'from subprocess
import call, PIPE; from bzrlib.workingtree import WorkingTree; from
bzrlib.branch import Branch; import os, re, sys, time'"

Which allows me to do stuff like:

TIMEIT "call([sys.executable, 'bzr', 'st'], stdout=PIPE)"

If I want to test command-line level performance. And

TIMEIT -s "b = Branch.open('.'); b.lock_read()"  "b.do_something()"

If I just want to test a particular function.

I would say the primary command to focus on for 'ignore' is 'status'.
And internally that would be the 'iter_changes' functionality.

TIMEIT -s "wt = WorkingTree.open_containing('.')[0]; wt.lock_read();"\
 -s "basis = wt.basis_tree(); basis.lock_read()"\
 "list(wt.iter_changes(basis))"

(You may need to supply some flags.)

You'll also want to make sure you are testing with a filesytem that
actually has ignored files. Certainly it is easy to be fast with a
pristine system :). A bzr source directory with .pyc files would
probably be reasonable. Your home dir might also have a decent mix of
ignored versus unknown versus versioned.


> Notes on remaining work on this feature:
> 
> The current branch handles basic ignore exclusions, where an '!' is prefixed to
> an ignore pattern to cause matched files to not be ignored.  Exclusion patterns
> take precedence over regular ignore patterns, regardless of order in .bzrignore.
> 
> This works OK for basic file-centric patterns such as this:
> --- sample .bzrignore ---
> # ignore generated HTML files
> *.html
> # but not a few kinds of hand-maintained HTML files
> !foo.html
> !bar.html
> --- end sample ---
> 
> But it doesn't capture the more complex use case of making ignores useful when
> overlaying a repository on an existing directory with non-versioned files, for
> example when versioning partial contents of one's home directory or /etc. 
> Example of a homedir .bzrignore file:
> 
> --- sample .bzrignore #2 ---
> # ignore everything
> *
> # but not the stuff we manage by-hand
> # ~/local is versioned
> !./local
> !./local/**/*
> # zsh dirs and files are versioned
> !RE:^\.z.*
> --- end sample #2 ---
> 
> But what happens when we note that .zcompdump is a file generated by zsh, which
> shouldn't be versioned?  Ideally we'd like to ignore it.  In the second example,
> we're really creating a filter for files to consider as versioned, with a desire
> for vanilla ignore capability under that.  I have a few ideas as to how this
> could work.  The simplest is to allow double-negation, assigning highest
> matching priority to double-negated patterns:
> 
> --- sample .bzrignore #3 ---
> # ignore everything
> *
> # except this stuff
> !./local
> !./local/**/*
> !RE:^\.z.*
> # but we really didn't want this
> !!./.zcompdump
> --- end sample #3 ---
> 
> This is a pretty straightforward extension of the work I've already done.  I'd
> really like feedback on the proposal illustrated in sample #3 -- what do folks
> think?
> 
> Thanks,
> John
> 

Another possibility is to have exact matches take precedence over
pattern matches. So if you have:

# ignore everything
*
# but not foo
!foo.html
# Locally, we want to version build results
!**/*.o
# But not this one
foo/bar.o

So the priority checking would be

1) Pattern matching ignores
2) Pattern matching don't-ignore
3) Exact matching ignores
4) Exact matching don't-ignore

*I* probably prefer that to !! syntax.

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

iEYEARECAAYFAktCPG4ACgkQJdeBCYSNAAO6CQCfaC4yqfYE2TTZD3yb8GNt8YuT
ymkAoNgITznGmSVsQT5vPeg7w0RBi/F7
=ZJfS
-----END PGP SIGNATURE-----



More information about the bazaar mailing list