##// END OF EJS Templates
dirstate: use a presized dict for the dirstate...
Siddharth Agarwal -
r25585:868b7ee8 default
parent child Browse files
Show More
@@ -338,6 +338,19 b' class dirstate(object):'
338 338 if not st:
339 339 return
340 340
341 if util.safehasattr(parsers, 'dict_new_presized'):
342 # Make an estimate of the number of files in the dirstate based on
343 # its size. From a linear regression on a set of real-world repos,
344 # all over 10,000 files, the size of a dirstate entry is 85
345 # bytes. The cost of resizing is significantly higher than the cost
346 # of filling in a larger presized dict, so subtract 20% from the
347 # size.
348 #
349 # This heuristic is imperfect in many ways, so in a future dirstate
350 # format update it makes sense to just record the number of entries
351 # on write.
352 self._map = parsers.dict_new_presized(len(st) / 71)
353
341 354 # Python's garbage collector triggers a GC each time a certain number
342 355 # of container objects (the number being defined by
343 356 # gc.get_threshold()) are allocated. parse_dirstate creates a tuple
General Comments 0
You need to be logged in to leave comments. Login now