# HG changeset patch # User Pierre-Yves David # Date 1496135522 -7200 # Node ID d95006fe4dd0f2ca11d4eae8b9bc231e10859e97 # Parent cdf6a0e028c02a0bc42f2c617c1ebfa479c0e9d3 stablerange: use last recently used caching for revisions associated to ranges This does not make things faster but at least it make them able to finish on large repositories. diff -r cdf6a0e028c0 -r d95006fe4dd0 README --- a/README Tue May 30 11:12:12 2017 +0200 +++ b/README Tue May 30 11:12:02 2017 +0200 @@ -122,6 +122,8 @@ - template: add a 'precursors' template that display the closests precursors of changesets - template: add a 'successors' template that display the closests successors of changesets - template: add a 'obsfate' template that display how a changeset has evolved + - new discovery experiment: add options to restrict memory consumption on + large repository (see "hg help -e evolve" for details). 6.2.2 - in progress ------------------- diff -r cdf6a0e028c0 -r d95006fe4dd0 hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py Tue May 30 11:12:12 2017 +0200 +++ b/hgext3rd/evolve/__init__.py Tue May 30 11:12:02 2017 +0200 @@ -78,6 +78,13 @@ [extensions] blackbox = +Finally some extra option are available to help tame the experimental +implementation of some of the algorithms: + + [experimental] + # restrict cache size to reduce memory consumption + obshashrange.lru-size = 2000 # default is 2000 + Effect Flag Experiment ====================== diff -r cdf6a0e028c0 -r d95006fe4dd0 hgext3rd/evolve/stablerange.py --- a/hgext3rd/evolve/stablerange.py Tue May 30 11:12:12 2017 +0200 +++ b/hgext3rd/evolve/stablerange.py Tue May 30 11:12:02 2017 +0200 @@ -241,7 +241,7 @@ class stablerange(object): - def __init__(self): + def __init__(self, lrusize=2000): # The point up to which we have data in cache self._tiprev = None self._tipnode = None @@ -254,10 +254,10 @@ # and then use the relevant top most part. This order is going to be # the same for all ranges headed at the same merge. So we cache these # value to reuse them accross the same invocation. - self._stablesortcache = {} + self._stablesortcache = util.lrucachedict(lrusize) # something useful to compute the above # mergerev -> stablesort, length - self._stablesortprepared = {} + self._stablesortprepared = util.lrucachedict(lrusize) # caching parent call # as we do so many of them self._parentscache = {} # The first part of the stable sorted list of revision of a merge will @@ -740,7 +740,9 @@ _schemaversion = 0 def __init__(self, repo): - super(sqlstablerange, self).__init__() + lrusize = repo.ui.configint('experimental', 'obshashrange.lru-size', + 2000) + super(sqlstablerange, self).__init__(lrusize=lrusize) self._vfs = repo.vfs self._path = repo.vfs.join('cache/evoext_stablerange_v0.sqlite') self._cl = repo.unfiltered().changelog # (okay to keep an old one)