Mercurial > hg
changeset 5727:1325ebc29e29
bisect: use array.array rather than lists for ancestor lists
This nearly doubles performance and cuts memory usage in half on large
bisections.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 27 Dec 2007 23:55:39 -0600 |
parents | 19cbe2aea2bc |
children | f3374025fe09 |
files | hgext/hbisect.py |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/hbisect.py Thu Dec 27 23:55:39 2007 -0600 +++ b/hgext/hbisect.py Thu Dec 27 23:55:39 2007 -0600 @@ -8,7 +8,7 @@ from mercurial.i18n import _ from mercurial import hg, util, commands, cmdutil -import os, sys +import os, sys, array class bisect(object): """dichotomic search in the DAG of changesets""" @@ -104,13 +104,13 @@ a = dict.fromkeys(a2) a.update(dict.fromkeys(a1)) a[rev] = None - ancestors[rev] = a.keys() + ancestors[rev] = array.array("l", a.keys()) else: - ancestors[rev] = a1 + [rev] + ancestors[rev] = a1 + array.array("l", [rev]) elif a2: - ancestors[rev] = a2 + [rev] + ancestors[rev] = a2 + array.array("l", [rev]) else: - ancestors[rev] = [rev] + ancestors[rev] = array.array("l", [rev]) if badrev not in ancestors[badrev]: raise util.Abort(_("Could not find the first bad revision"))