##// END OF EJS Templates
discovery: cache the children mapping used during each discovery...
marmoute -
r42051:5baf06d2 default
parent child Browse files
Show More
@@ -116,6 +116,7 b' class partialdiscovery(object):'
116 116 self._common = repo.changelog.incrementalmissingrevs()
117 117 self._undecided = None
118 118 self.missing = set()
119 self._childrenmap = None
119 120
120 121 def addcommons(self, commons):
121 122 """registrer nodes known as common"""
@@ -173,15 +174,14 b' class partialdiscovery(object):'
173 174
174 175 def _childrengetter(self, revs):
175 176
177 if self._childrenmap is not None:
178 return self._childrenmap.__getitem__
179
176 180 # _updatesample() essentially does interaction over revisions to look
177 181 # up their children. This lookup is expensive and doing it in a loop is
178 182 # quadratic. We precompute the children for all relevant revisions and
179 183 # make the lookup in _updatesample() a simple dict lookup.
180 #
181 # Because this function can be called multiple times during discovery,
182 # we may still perform redundant work and there is room to optimize
183 # this by keeping a persistent cache of children across invocations.
184 children = {}
184 self._childrenmap = children = {}
185 185
186 186 parentrevs = self._parentsgetter()
187 187
General Comments 0
You need to be logged in to leave comments. Login now