[MERGE] Speed up log --short / --line

Aaron Bentley aaron at aaronbentley.com
Mon Mar 24 20:36:19 GMT 2008


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

Hi all,

This patch optimizes log operations, by providing a fast-path for
calculating view revisions when no merged revisions will be shown.  I've
written it as an alternative to Michael Hudson's cheaper-simple-logging
patch.

Like Michael's approach, this fast path only works when no start or end
revision is specified, but could be extended to allow both.

Unlike Michael's patch, this approach retains the ability to retrieve
multiple revisions at once.

The attack is two-pronged;
1. iter_revisions is extracted and adjusted to make good use of iterators.
2. the logic that generates view_revisions is extracted and adjusted to
provide a fast path in the simple case, which returns a generator.

Since the fast path uses iter_reverse_revision_history, I've tested with
and without John's revision_spec patch to implement that directly on Graph.

Here are the results (best of 5) on the Python 2.5 import with "bzr
- --no-aliases log --short -l 9".  This is the maximum time that it takes
for bzr to fill up a screen with logs.

bzr.dev
- -------
real	0m6.985s
user	0m6.608s
sys	0m0.200s

cheaper-simple-logging
- ----------------------
real	0m0.309s
user	0m0.228s
sys	0m0.064s

fast-log
- --------
real	0m0.301s
user	0m0.228s
sys	0m0.060s

fast-log + revision_spec
- ------------------------
real	0m0.308s
user	0m0.236s
sys	0m0.060s

Here are the results for bzr --no-aliases log --short >/dev/null (one
run only)

bzr.dev
- -------
real	0m22.788s
user	0m21.697s
sys	0m0.476s

cheaper-simple-logging
- ----------------------
real	0m30.819s
user	0m28.902s
sys	0m1.276s

fast-log
- --------
real	0m21.706s
user	0m20.681s
sys	0m0.516s

fast-log + revision_spec
- ------------------------
real	0m20.678s
user	0m19.701s
sys	0m0.420s

To sum up,
- - fast-log is the fastest at both scenarios, but the second-place
  contender is within the margin of error.
- - bzr.dev is nearly as fast for large numbers of revisions
- - cheaper-simple-logging is nearly as fast for small numbers of
  revisions.
- - the revision_spec patch is not a significant benefit in these
  scenarios.

Aaron

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH6BDC0F+nu1YWqI0RAg8SAJ9sPqyqdjJwidVZUQCP7sab22hj7QCdEQge
3HkDVrl465vTTN+SZPiOHaE=
=TP6k
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: show_log-3306.patch
Type: text/x-diff
Size: 10059 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080324/db185158/attachment-0001.bin 


More information about the bazaar mailing list