Mercurial > evolve
diff hgext/evolve.py @ 1203:936aa82884ab stable
evolve: cache marker encoding to avoid performance degradation
The main overhead in bug 4518 is caused by calculating relevant markers
and encoding markers into the correct format.
Calculating relevant markers takes (worst case) ~ 0.12 seconds.
Encoding markers takes (worst case) ~ 0.06 seconds.
Caching encoded markers takes care of the second part and
speeds up cloning in bug 4518 by about 35%.
author | Mathias De Maré <mathias.demare@gmail.com> |
---|---|
date | Mon, 02 Mar 2015 20:12:00 +0100 |
parents | 4099b087f672 |
children | 161b8f6e7402 |
line wrap: on
line diff
--- a/hgext/evolve.py Fri Feb 06 17:01:28 2015 +0000 +++ b/hgext/evolve.py Mon Mar 02 20:12:00 2015 +0100 @@ -2729,6 +2729,7 @@ def _obsrelsethashtree(repo): cache = [] unfi = repo.unfiltered() + markercache = {} for i in unfi: ctx = unfi[i] entry = 0 @@ -2745,7 +2746,11 @@ sha.update(p) tmarkers = repo.obsstore.relevantmarkers([ctx.node()]) if tmarkers: - bmarkers = [obsolete._fm0encodeonemarker(m) for m in tmarkers] + bmarkers = [] + for m in tmarkers: + if not m in markercache: + markercache[m] = obsolete._fm0encodeonemarker(m) + bmarkers.append(markercache[m]) bmarkers.sort() for m in bmarkers: entry += 1