# HG changeset patch # User Mathias De Maré # Date 1425323520 -3600 # Node ID 936aa82884aba4521b8237bfac7140bde8153e89 # Parent 4099b087f6725a3a3d599e19fd7d3dc02e0d60b2 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%. diff -r 4099b087f672 -r 936aa82884ab hgext/evolve.py --- 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