Mercurial > evolve
comparison 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 |
comparison
equal
deleted
inserted
replaced
1202:4099b087f672 | 1203:936aa82884ab |
---|---|
2727 return wireproto.streamres(proto.groupchunks(finaldata)) | 2727 return wireproto.streamres(proto.groupchunks(finaldata)) |
2728 | 2728 |
2729 def _obsrelsethashtree(repo): | 2729 def _obsrelsethashtree(repo): |
2730 cache = [] | 2730 cache = [] |
2731 unfi = repo.unfiltered() | 2731 unfi = repo.unfiltered() |
2732 markercache = {} | |
2732 for i in unfi: | 2733 for i in unfi: |
2733 ctx = unfi[i] | 2734 ctx = unfi[i] |
2734 entry = 0 | 2735 entry = 0 |
2735 sha = util.sha1() | 2736 sha = util.sha1() |
2736 # add data from p1 | 2737 # add data from p1 |
2743 if p != nullid: | 2744 if p != nullid: |
2744 entry += 1 | 2745 entry += 1 |
2745 sha.update(p) | 2746 sha.update(p) |
2746 tmarkers = repo.obsstore.relevantmarkers([ctx.node()]) | 2747 tmarkers = repo.obsstore.relevantmarkers([ctx.node()]) |
2747 if tmarkers: | 2748 if tmarkers: |
2748 bmarkers = [obsolete._fm0encodeonemarker(m) for m in tmarkers] | 2749 bmarkers = [] |
2750 for m in tmarkers: | |
2751 if not m in markercache: | |
2752 markercache[m] = obsolete._fm0encodeonemarker(m) | |
2753 bmarkers.append(markercache[m]) | |
2749 bmarkers.sort() | 2754 bmarkers.sort() |
2750 for m in bmarkers: | 2755 for m in bmarkers: |
2751 entry += 1 | 2756 entry += 1 |
2752 sha.update(m) | 2757 sha.update(m) |
2753 if entry: | 2758 if entry: |