bzr diff slow against ancestor

Bug #202928 reported by Stefan Monnier
2
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Aaron Bentley

Bug Description

Running bzr diff against the parent parent branch in Emacs's Bzr repository takes an inordinate amount of time:

bzr diff -r ancestor:../trunk/ lisp/vc-bzr.el 58.30s user 0.18s system 99% cpu 58.613 total

This is on a 2.4GHz Althlon X2 with 4GB of RAM. It's an operation I do extremely often.

Tags: emacs
Revision history for this message
John A Meinel (jameinel) wrote :

There are a couple of patches on the mailing list that should address this.

Basically, the current bzr --revision lookup has 2 "iterate the history to figure out the revno" calls which aren't actually needed.

The patches work around it a bit, and in my testing drops it from 14s => 0.7s.

So it isn't the common ancestor code (Graph.find_unique_lca) it is the "revision_id => revno" (RevisionSpec) code.

Changed in bzr:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
hackworks (hackworks) wrote :

Since we are testing bzr for emacs, I request you to make a branch with all performance improvements. I am willing to test and provide feedback.

Revision history for this message
Stefan Monnier (monnier) wrote : Re: [Bug 202928] Re: bzr diff slow against ancestor

> Since we are testing bzr for emacs, I request you to make a branch with
> all performance improvements. I am willing to test and provide feedback.

I have no idea what you're talking about.
A branch of what?

        Stefan

Revision history for this message
Jonathan Lange (jml) wrote :

dhruva, Bazaar has a 4-week release cycle, and generally patches make their way into trunk rather quickly.

If you want to test and provide feedback, the best thing for you to do is use the Bazaar trunk: http://bazaar-vcs.org/bzr/bzr.dev

Revision history for this message
Jonathan Lange (jml) wrote :

Stefan,

Thanks for filing this bug. I've got a couple of things you might want to try -- I've no idea whether they'll be faster, but the numbers will be interesting.

In trunk, do 'bzr merge --preview ../some-branch'. That's like 'diff -r ancestor' except a little more thorough.

The other thing is to do the operation on the whole tree, rather than a single file. My hunch is that it'll take about the same time as for the one file.

jml

Revision history for this message
Stefan Monnier (monnier) wrote :

> Thanks for filing this bug. I've got a couple of things you might want
> to try -- I've no idea whether they'll be faster, but the numbers will
> be interesting.

> In trunk, do 'bzr merge --preview ../some-branch'. That's like 'diff -r
> ancestor' except a little more thorough.

Actually, it's quite different:

         +-------------+- BRANCH
        / /
       / /
   ---+-------------+--+- ANCESTOR
                    |
                  BASE

your command gives me a diff between BASE and ANCESTOR, whereas the one
I want is between BASE and BRANCH.

> The other thing is to do the operation on the whole tree, rather than a
> single file. My hunch is that it'll take about the same time as for the
> one file.

Actually the diff between BASE and BRANCH is almost 2MB, so it does take
a little bit longer, but of course not much (it's pretty clear that the
time is not spent diffing) and more importantly for me it doesn't really
give me the info I want (well, it does, but then I have to look for
those few relevant lines among the ton of irrelevant output).

   % time bzr diff -r ancestor:../trunk src/coding.c | wc
        40 133 1086
   bzr diff -r ancestor:../trunk src/coding.c 139.30s user 0.34s system 99% cpu 2:20.31 total
   wc 0.00s user 0.00s system 0% cpu 2:20.31 total
   % time bzr diff -r ancestor:../trunk | wc
     47569 216917 1703489
   bzr diff -r ancestor:../trunk 156.43s user 0.58s system 99% cpu 2:37.88 total
   wc 0.15s user 0.00s system 0% cpu 2:37.88 total
   %

-- Stefan

Revision history for this message
John A Meinel (jameinel) wrote :

Aaron committed a fix for this in bzr 1.5:
* Diff now handles revision specs like "branch:" and "submit:" more
  efficiently. (Aaron Bentley)

Changed in bzr:
assignee: nobody → abentley
milestone: none → 1.5
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.