Mercurial > hg
view mercurial/cacheutil.py @ 39460:35ecaa999a12
match: improve includematcher.visitchildrenset to be much faster and cached
This improves the speed of visitchildrenset considerably, especially when there
are complicated matchers involved that may have many entries in _dirs or
_parents.
Unfortunately the benchmark isn't easily upstreamed due to its reliance on
https://github.com/vstinner/perf (primarily due to the conflict when importing
it if I were to contribute the benchmark as contrib/matcherbenchmarks.py)
instead of asv or some other perf measurement system.
To describe the benchmark briefly: I generated an includematcher of either 5 or
3500 "rootfilesin:prefix1/prefix2/prefix3/<randomsubdirs, 1-8 levels deep>"
items in the 'setup' function, and then called
`im.visitchildrenset('prefix1/prefix2')` in the 'stmt' function in perf.timeit.
For the set of 5:
- before: 15.3 us +- 2.9 us
- after: 1.59 us +- 0.02 us
For the set of 3500:
- before: 3.90 ms +- 0.10 ms
- after: 3.15 us +- 0.09 us (note the m->u change)
Differential Revision: https://phab.mercurial-scm.org/D4351
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Fri, 17 Aug 2018 19:18:53 -0700 |
parents | 72fdd99eb526 |
children | 57875cf423c9 |
line wrap: on
line source
# scmutil.py - Mercurial core utility functions # # Copyright Matt Mackall <mpm@selenic.com> and other # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. from __future__ import absolute_import from . import repoview def cachetocopy(srcrepo): """return the list of cache file valuable to copy during a clone""" # In local clones we're copying all nodes, not just served # ones. Therefore copy all branch caches over. cachefiles = ['branch2'] cachefiles += ['branch2-%s' % f for f in repoview.filtertable] cachefiles += ['rbc-names-v1', 'rbc-revs-v1'] cachefiles += ['tags2'] cachefiles += ['tags2-%s' % f for f in repoview.filtertable] cachefiles += ['hgtagsfnodes1'] return cachefiles