Show More
@@ -338,6 +338,19 b' class dirstate(object):' | |||||
338 | if not st: |
|
338 | if not st: | |
339 | return |
|
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 | # Python's garbage collector triggers a GC each time a certain number |
|
354 | # Python's garbage collector triggers a GC each time a certain number | |
342 | # of container objects (the number being defined by |
|
355 | # of container objects (the number being defined by | |
343 | # gc.get_threshold()) are allocated. parse_dirstate creates a tuple |
|
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