Patchwork D1499: hbisect: use a defaultdict to avoid large allocations for a large changelogs

login
register
mail settings
Submitter phabricator
Date Nov. 25, 2017, 4:30 a.m.
Message ID <3b1b08473e21fab9a564a10650c8bbfb@localhost.localdomain>
Download mbox | patch
Permalink /patch/25742/
State Not Applicable
Headers show

Comments

phabricator - Nov. 25, 2017, 4:30 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8287df8b7be5: hbisect: use a defaultdict to avoid large allocations for a large changelogs (authored by dsp, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1499?vs=3805&id=3858

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

AFFECTED FILES
  mercurial/hbisect.py

CHANGE DETAILS




To: dsp, #hg-reviewers, yuja
Cc: mercurial-devel

Patch

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: