Mercurial > hg > evolve
changeset 1299: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 |
files | hgext/evolve.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/evolve.py +++ b/hgext/evolve.py @@ -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