dsp created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We can avoid a SPACE(len(changelog)) allocation by using a defaultdict.

TEST PLAN
    python run-tests.py test-bisect*

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1499

AFFECTED FILES
  mercurial/hbisect.py

CHANGE DETAILS

diff --git a/mercurial/hbisect.py b/mercurial/hbisect.py
--- a/mercurial/hbisect.py
+++ b/mercurial/hbisect.py
@@ -38,7 +38,7 @@
 
     def buildancestors(bad, good):
         badrev = min([changelog.rev(n) for n in bad])
-        ancestors = [None] * (len(changelog) + 1)
+        ancestors = collections.defaultdict(lambda: None)
         for rev in repo.revs("descendants(%ln) - ancestors(%ln)", good, good):
             ancestors[rev] = []
         if ancestors[badrev] is None:



To: dsp, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to