Can "bzr annotate" be sped up?
Eli Zaretskii
eliz at gnu.org
Fri Jun 17 09:16:46 UTC 2011
Currently, "bzr annotate" is quite slow, for a file with lots of
revisions. This example is taken from Emacs:
D:\gnu\bzr\emacs\trunk>timep bzr annotate src/xdisp.c > nul
real 00h01m23.421s
user 00h01m18.734s
sys 00h00m03.046s
Similarly, "bzr log -r annotate:..." takes almost the same time; I'm
guessing it does under the hood most of the work that "bzr annotate"
does:
D:\gnu\bzr\emacs\trunk>timep bzr log -r annotate:src/xdisp.c:25915 > nul
real 00h01m14.656s
user 00h01m09.890s
sys 00h00m03.890s
src/xdisp.c has 2072 revisions. For a file with fewer revisions it
takes less time:
D:\gnu\bzr\emacs\trunk>timep bzr annotate src/bidi.c > nul
real 00h00m24.562s
user 00h00m23.578s
sys 00h00m00.437s
src/bidi.c has only 74 revisions.
Btw, a large portion of the time for xdisp.c (0m55s out of 1m20s) is
spent in a phase that displays "extracting 0/2007" on the screen.
This part is instantaneous for bidi.c, so the "extracting" thing just
flashes on the screen and disappears right away.
Can "annotate" be sped up, please?
Perhaps people think that "annotate" is not a command that is
important enough to be fast. (Git designers certainly think that, and
"git annotate" is abysmally slow, about 6 time slower than Bazaar.)
But there are important use cases where "annotate" is an invaluable
tool, and I'm living that use case for the past 2 years: when you need
to make a deep surgery on a central and very complex part of a large
and old project, and the original designers of that central part are
no longer available. (xdisp.c contains most of the Emacs display
engine, and I'm working on adding to it support for bidirectional
editing.) In these use cases, one frequently bumps into code that
doesn't always make sense and is not commented adequately enough to
explain why it is written like it is. In these situations, the most
efficient way of figuring out the code is to find the commit(s) which
changed it and any related commits elsewhere in the project, and then
look in the mailing list archives for related discussions, bug
reports, test cases, etc. "annotate" or "log -r annotate:" are the
first step in such inquiries, and I'm not aware of any other tools
that can replace "annotate" in this role.
So: can "annotate" be made faster?
TIA
More information about the bazaar
mailing list