Mercurial > hg
comparison contrib/perf.py @ 41615:328ca3b9e545
branchmap: encapsulate cache updating in the map itself
Rather than have a repository update the cache, move handling of cache updates
into the branchmap module, in the form of a custom mapping class.
This makes later performance improvements easier to handle too.
Differential Revision: https://phab.mercurial-scm.org/D5638
author | Martijn Pieters <mj@octobus.net> |
---|---|
date | Mon, 21 Jan 2019 17:37:33 +0000 |
parents | bf7fb97aecf1 |
children | 6a447a3d1bd0 |
comparison
equal
deleted
inserted
replaced
41612:fbd4ce55bcbd | 41615:328ca3b9e545 |
---|---|
2374 """generate a benchmark function for the filtername""" | 2374 """generate a benchmark function for the filtername""" |
2375 if filtername is None: | 2375 if filtername is None: |
2376 view = repo | 2376 view = repo |
2377 else: | 2377 else: |
2378 view = repo.filtered(filtername) | 2378 view = repo.filtered(filtername) |
2379 if util.safehasattr(view._branchcaches, '_per_filter'): | |
2380 filtered = view._branchcaches._per_filter | |
2381 else: | |
2382 # older versions | |
2383 filtered = view._branchcaches | |
2379 def d(): | 2384 def d(): |
2380 if clear_revbranch: | 2385 if clear_revbranch: |
2381 repo.revbranchcache()._clear() | 2386 repo.revbranchcache()._clear() |
2382 if full: | 2387 if full: |
2383 view._branchcaches.clear() | 2388 view._branchcaches.clear() |
2384 else: | 2389 else: |
2385 view._branchcaches.pop(filtername, None) | 2390 filtered.pop(filtername, None) |
2386 view.branchmap() | 2391 view.branchmap() |
2387 return d | 2392 return d |
2388 # add filter in smaller subset to bigger subset | 2393 # add filter in smaller subset to bigger subset |
2389 possiblefilters = set(repoview.filtertable) | 2394 possiblefilters = set(repoview.filtertable) |
2390 if filternames: | 2395 if filternames: |