[MERGE REVIEW] Performance tweak for TreeTransform
Robert Collins
robertc at robertcollins.net
Thu May 25 01:03:11 BST 2006
On Wed, 2006-05-24 at 17:17 -0500, John Arbash Meinel wrote:
> Aaron Bentley wrote:
> > Hi all,
> >
> > I've done some profiling of TreeTransform (through the bzrtools import
> > command) and found that TreeTransform.canonical_path was taking a lot of
> > time. This patch speeds up canonical_path by a factor of 10, which
> > increases overall import speed by 1/4 - 1/3.
> >
> > Aaron
>
> The code looks pretty good. Do you have a branch of this somewhere?
>
> I assume that the cache only lasts as long as the Transform object, right?
>
> This doesn't seem to effect the time to build a tree, (at least by my
> measured times for bzr branch). So what does this effect? Is it the
> commit time, or the add time? I'm not sure what you mean by "import speed".
>
> Also, this seems like a really good place to write one of our new
> benchmark tests. Though since I really don't know how to do it, I
> certainly wouldn't block merging it.
Martin and I did some more pair programming yesterday, and we've added a
really useful feature ;).
./bzr selftest --benchmark --lsprof-timed
This new flag will run lsprof (as long as its in the python path) over
the callable that 'self.time' invokes and output the profile data.
So a trivial benchmark:
class BenchTreeTransform(Benchmark):
def call_canonical_path_20000_times(self, transform):
"""Helper for test_canonical_path_performance."""
for count in range(20000):
transform.canonical_path('foo')
def test_canonical_path_performance(self):
"""canonical_path should be able to do 20000 calls in 1
second."""
transform = TreeTransform()
self.time(self.call_canonical_path_20000_times, transform)
can be run as './bzr selftest --benchmark --lsprof-timed
canonical_path', and will profile call_canonical_path_20000_times (and
only that) for you.
Cheers,
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/20060525/c677e4b5/attachment.pgp
More information about the bazaar
mailing list