##// END OF EJS Templates
snapshot: consider unrelated snapshots at a similar level first...
Boris Feld -
r39531:6a538427 default
parent child Browse files
Show More
@@ -616,9 +616,10 b' def _candidategroups(revlog, textlen, p1'
616 def _findsnapshots(revlog, cache, start_rev):
616 def _findsnapshots(revlog, cache, start_rev):
617 """find snapshot from start_rev to tip"""
617 """find snapshot from start_rev to tip"""
618 deltaparent = revlog.deltaparent
618 deltaparent = revlog.deltaparent
619 issnapshot = revlog.issnapshot
619 for rev in revlog.revs(start_rev):
620 for rev in revlog.revs(start_rev):
620 if deltaparent(rev) == nullrev:
621 if issnapshot(rev):
621 cache[nullrev].append(rev)
622 cache[deltaparent(rev)].append(rev)
622
623
623 def _rawgroups(revlog, p1, p2, cachedelta):
624 def _rawgroups(revlog, p1, p2, cachedelta):
624 """Provides group of revision to be tested as delta base
625 """Provides group of revision to be tested as delta base
@@ -673,11 +674,35 b' def _rawgroups(revlog, p1, p2, cachedelt'
673 if not revlog.issnapshot(s):
674 if not revlog.issnapshot(s):
674 break
675 break
675 parents_snaps[idx].add(s)
676 parents_snaps[idx].add(s)
677 snapfloor = min(parents_snaps[0]) + 1
678 _findsnapshots(revlog, snapshots, snapfloor)
676 # Test them as possible intermediate snapshot base
679 # Test them as possible intermediate snapshot base
677 # We test them from highest to lowest level. High level one are more
680 # We test them from highest to lowest level. High level one are more
678 # likely to result in small delta
681 # likely to result in small delta
682 floor = None
679 for idx, snaps in sorted(parents_snaps.items(), reverse=True):
683 for idx, snaps in sorted(parents_snaps.items(), reverse=True):
684 siblings = set()
685 for s in snaps:
686 siblings.update(snapshots[s])
687 # Before considering making a new intermediate snapshot, we check
688 # if an existing snapshot, children of base we consider, would be
689 # suitable.
690 #
691 # It give a change to reuse a delta chain "unrelated" to the
692 # current revision instead of starting our own. Without such
693 # re-use, topological branches would keep reopening new chains.
694 # Creating more and more snapshot as the repository grow.
695
696 if floor is not None:
697 # We only do this for siblings created after the one in our
698 # parent's delta chain. Those created before has less chances
699 # to be valid base since our ancestors had to create a new
700 # snapshot.
701 siblings = [r for r in siblings if floor < r]
702 yield tuple(sorted(siblings))
703 # then test the base from our parent's delta chain.
680 yield tuple(sorted(snaps))
704 yield tuple(sorted(snaps))
705 floor = min(snaps)
681 # No suitable base found in the parent chain, search if any full
706 # No suitable base found in the parent chain, search if any full
682 # snapshots emitted since parent's base would be a suitable base for an
707 # snapshots emitted since parent's base would be a suitable base for an
683 # intermediate snapshot.
708 # intermediate snapshot.
@@ -686,8 +711,6 b' def _rawgroups(revlog, p1, p2, cachedelt'
686 # revisions instead of starting our own. Without such re-use,
711 # revisions instead of starting our own. Without such re-use,
687 # topological branches would keep reopening new full chains. Creating
712 # topological branches would keep reopening new full chains. Creating
688 # more and more snapshot as the repository grow.
713 # more and more snapshot as the repository grow.
689 snapfloor = min(parents_snaps[0]) + 1
690 _findsnapshots(revlog, snapshots, snapfloor)
691 yield tuple(snapshots[nullrev])
714 yield tuple(snapshots[nullrev])
692
715
693 # other approach failed try against prev to hopefully save us a
716 # other approach failed try against prev to hopefully save us a
@@ -77,7 +77,7 b' repeatedly while some of it changes rare'
77
77
78
78
79 $ f -s .hg/store/data/*.d
79 $ f -s .hg/store/data/*.d
80 .hg/store/data/_s_p_a_r_s_e-_r_e_v_l_o_g-_t_e_s_t-_f_i_l_e.d: size=63812493
80 .hg/store/data/_s_p_a_r_s_e-_r_e_v_l_o_g-_t_e_s_t-_f_i_l_e.d: size=59303048
81 $ hg debugrevlog *
81 $ hg debugrevlog *
82 format : 1
82 format : 1
83 flags : generaldelta
83 flags : generaldelta
@@ -89,45 +89,45 b' repeatedly while some of it changes rare'
89 empty : 0 ( 0.00%)
89 empty : 0 ( 0.00%)
90 text : 0 (100.00%)
90 text : 0 (100.00%)
91 delta : 0 (100.00%)
91 delta : 0 (100.00%)
92 snapshot : 179 ( 3.58%)
92 snapshot : 165 ( 3.30%)
93 lvl-0 : 4 ( 0.08%)
93 lvl-0 : 4 ( 0.08%)
94 lvl-1 : 49 ( 0.98%)
94 lvl-1 : 17 ( 0.34%)
95 lvl-2 : 56 ( 1.12%)
95 lvl-2 : 46 ( 0.92%)
96 lvl-3 : 63 ( 1.26%)
96 lvl-3 : 62 ( 1.24%)
97 lvl-4 : 7 ( 0.14%)
97 lvl-4 : 36 ( 0.72%)
98 deltas : 4822 (96.42%)
98 deltas : 4836 (96.70%)
99 revision size : 63812493
99 revision size : 59303048
100 snapshot : 10745878 (16.84%)
100 snapshot : 6105443 (10.30%)
101 lvl-0 : 804204 ( 1.26%)
101 lvl-0 : 804187 ( 1.36%)
102 lvl-1 : 4986508 ( 7.81%)
102 lvl-1 : 1476228 ( 2.49%)
103 lvl-2 : 2858810 ( 4.48%)
103 lvl-2 : 1752567 ( 2.96%)
104 lvl-3 : 1958906 ( 3.07%)
104 lvl-3 : 1461776 ( 2.46%)
105 lvl-4 : 137450 ( 0.22%)
105 lvl-4 : 610685 ( 1.03%)
106 deltas : 53066615 (83.16%)
106 deltas : 53197605 (89.70%)
107
107
108 chunks : 5001
108 chunks : 5001
109 0x78 (x) : 5001 (100.00%)
109 0x78 (x) : 5001 (100.00%)
110 chunks size : 63812493
110 chunks size : 59303048
111 0x78 (x) : 63812493 (100.00%)
111 0x78 (x) : 59303048 (100.00%)
112
112
113 avg chain length : 17
113 avg chain length : 17
114 max chain length : 45
114 max chain length : 45
115 max chain reach : 27506743
115 max chain reach : 26194433
116 compression ratio : 27
116 compression ratio : 29
117
117
118 uncompressed data size (min/max/avg) : 346468 / 346472 / 346471
118 uncompressed data size (min/max/avg) : 346468 / 346472 / 346471
119 full revision size (min/max/avg) : 201007 / 201077 / 201051
119 full revision size (min/max/avg) : 200992 / 201080 / 201046
120 inter-snapshot size (min/max/avg) : 13223 / 172097 / 56809
120 inter-snapshot size (min/max/avg) : 11610 / 172762 / 32927
121 level-1 (min/max/avg) : 13223 / 172097 / 101765
121 level-1 (min/max/avg) : 15619 / 172762 / 86836
122 level-2 (min/max/avg) : 28558 / 85237 / 51050
122 level-2 (min/max/avg) : 13055 / 85219 / 38099
123 level-3 (min/max/avg) : 14647 / 41752 / 31093
123 level-3 (min/max/avg) : 11610 / 42645 / 23577
124 level-4 (min/max/avg) : 18596 / 20760 / 19635
124 level-4 (min/max/avg) : 12928 / 20205 / 16963
125 delta size (min/max/avg) : 10649 / 104791 / 11005
125 delta size (min/max/avg) : 10649 / 106863 / 11000
126
126
127 deltas against prev : 4171 (86.50%)
127 deltas against prev : 4162 (86.06%)
128 where prev = p1 : 4127 (98.95%)
128 where prev = p1 : 4120 (98.99%)
129 where prev = p2 : 0 ( 0.00%)
129 where prev = p2 : 0 ( 0.00%)
130 other : 44 ( 1.05%)
130 other : 42 ( 1.01%)
131 deltas against p1 : 633 (13.13%)
131 deltas against p1 : 653 (13.50%)
132 deltas against p2 : 18 ( 0.37%)
132 deltas against p2 : 21 ( 0.43%)
133 deltas against other : 0 ( 0.00%)
133 deltas against other : 0 ( 0.00%)
General Comments 0
You need to be logged in to leave comments. Login now