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%.
--- 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