[PATCH 6 of 7 Series-F] performance: speedup computation of suspended revisions

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Tue Jan 8 12:54:05 CST 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1357265744 -3600
# Node ID e6c89c648f69dee51e50a61e2d29ad05e67f97df
# Parent  27948abcf3a5d4bf99f8a99e808be33803dc83d0
performance: speedup computation of suspended revisions

In they current state revset call can be very costly as we test predicates on
the will repository.

The current changeset drop revset call in favor of direct testing of the phase
of changeset.


Performance test on my Mercurial checkout

- 19857 total changesets,
- 1584 obsolete changesets,
- 13310 obsolescence markers.

Before this changes, :

  ! obsolete
  ! wall 0.004426 comb 0.000000 user 0.000000 sys 0.000000 (best of 582)
  ! suspended
  ! wall 0.014319 comb 0.020000 user 0.020000 sys 0.000000 (best of 201)


After this changes:

  ! obsolete
  ! wall 0.004488 comb 0.000000 user 0.000000 sys 0.000000 (best of 561)
  ! suspended
  ! wall 0.009559 comb 0.010000 user 0.010000 sys 0.000000 (best of 294)

Performance test on a Mozilla central checkout:

- 117293 total changesets,
- 1 obsolete changeset,
- 1 obsolescence marker.

Before this changes, :

  ! obsolete
  ! wall 0.000017 comb 0.000000 user 0.000000 sys 0.000000 (best of 106938)
  ! suspended
  ! wall 0.033373 comb 0.030000 user 0.030000 sys 0.000000 (best of 100)

After this changes:

  ! obsolete
  ! wall 0.000017 comb 0.000000 user 0.000000 sys 0.000000 (best of 100950)
  ! suspended
  ! wall 0.000053 comb 0.000000 user 0.000000 sys 0.000000 (best of 49843)

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -669,11 +669,12 @@ def _computeunstableset(repo):
     return set(r for r in cl.descendants(obs) if r not in obs)
 
 @cachefor('suspended')
 def _computesuspendedset(repo):
     """the set of obsolete parents with non obsolete descendants"""
-    return set(repo.revs('obsolete() and obsolete()::unstable()'))
+    suspended = repo.changelog.ancestors(getrevs(repo, 'unstable'))
+    return set(r for r in getrevs(repo, 'obsolete') if r in suspended)
 
 @cachefor('extinct')
 def _computeextinctset(repo):
     """the set of obsolete parents without non obsolete descendants"""
     return set(repo.revs('obsolete() - obsolete()::unstable()'))


More information about the Mercurial-devel mailing list