contrib/perf.py
author pozheg <pozheg@gmail.com>
Tue, 16 Apr 2013 22:00:05 -0500
changeset 19012 811e253226c3
parent 18877 2e9fe9e2671f
child 19292 e0aa6fff8f02
permissions -rw-r--r--
subrepo: clone of git sub-repository creates incorrect git branch (issue3870) Mercurial handles git subrepos by incorrect way. If the mercurial repo has a git sub-repo and somebody started a new branch in the subrepo and push it into git, the next one who will clone the whole repo will get incorrect branch name in the git subrepo.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     1
# perf.py - performance test routines
8873
e872ef2e6758 help: add/fix docstrings for a bunch of extensions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8656
diff changeset
     2
'''helper extension to measure performance'''
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     3
18240
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
     4
from mercurial import cmdutil, scmutil, util, match, commands, obsolete
18877
2e9fe9e2671f perf: add a command to test copies.pathcopies perf
Siddharth Agarwal <sid0@fb.com>
parents: 18871
diff changeset
     5
from mercurial import repoview, branchmap, merge, copies
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     6
import time, os, sys
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     7
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
     8
cmdtable = {}
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
     9
command = cmdutil.command(cmdtable)
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
    10
9826
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
    11
def timer(func, title=None):
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    12
    results = []
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    13
    begin = time.time()
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    14
    count = 0
14494
1ffeeb91c55d check-code: flag 0/1 used as constant Boolean expression
Martin Geisler <mg@lazybytes.net>
parents: 14322
diff changeset
    15
    while True:
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    16
        ostart = os.times()
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    17
        cstart = time.time()
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    18
        r = func()
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    19
        cstop = time.time()
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    20
        ostop = os.times()
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    21
        count += 1
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    22
        a, b = ostart, ostop
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    23
        results.append((cstop - cstart, b[0] - a[0], b[1]-a[1]))
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    24
        if cstop - begin > 3 and count >= 100:
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    25
            break
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    26
        if cstop - begin > 10 and count >= 3:
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    27
            break
9826
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
    28
    if title:
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
    29
        sys.stderr.write("! %s\n" % title)
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    30
    if r:
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    31
        sys.stderr.write("! result: %s\n" % r)
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    32
    m = min(results)
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    33
    sys.stderr.write("! wall %f comb %f user %f sys %f (best of %d)\n"
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    34
                     % (m[0], m[1] + m[2], m[1], m[2], count))
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    35
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
    36
@command('perfwalk')
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    37
def perfwalk(ui, repo, *pats):
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    38
    try:
14671
35c2cc322ba8 scmutil: switch match users to supplying contexts
Matt Mackall <mpm@selenic.com>
parents: 14494
diff changeset
    39
        m = scmutil.match(repo[None], pats, {})
10176
24ce8f0c0a39 dirstate: don't check state of subrepo directories
Augie Fackler <durin42@gmail.com>
parents: 9932
diff changeset
    40
        timer(lambda: len(list(repo.dirstate.walk(m, [], True, False))))
16689
f366d4c2ff34 cleanup: replace naked excepts with except Exception: ...
Brodie Rao <brodie@sf.io>
parents: 16683
diff changeset
    41
    except Exception:
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    42
        try:
14671
35c2cc322ba8 scmutil: switch match users to supplying contexts
Matt Mackall <mpm@selenic.com>
parents: 14494
diff changeset
    43
            m = scmutil.match(repo[None], pats, {})
10282
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10176
diff changeset
    44
            timer(lambda: len([b for a, b, c in repo.dirstate.statwalk([], m)]))
16689
f366d4c2ff34 cleanup: replace naked excepts with except Exception: ...
Brodie Rao <brodie@sf.io>
parents: 16683
diff changeset
    45
        except Exception:
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    46
            timer(lambda: len(list(cmdutil.walk(repo, pats, {}))))
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    47
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
    48
@command('perfstatus',
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
    49
         [('u', 'unknown', False,
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
    50
           'ask status to look for unknown files')])
18033
00ac420f24ee perf: add option to perfstatus to get the status of unknown files
Siddharth Agarwal <sid0@fb.com>
parents: 17780
diff changeset
    51
def perfstatus(ui, repo, **opts):
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    52
    #m = match.always(repo.root, repo.getcwd())
16683
525fdb738975 cleanup: eradicate long lines
Brodie Rao <brodie@sf.io>
parents: 16414
diff changeset
    53
    #timer(lambda: sum(map(len, repo.dirstate.status(m, [], False, False,
525fdb738975 cleanup: eradicate long lines
Brodie Rao <brodie@sf.io>
parents: 16414
diff changeset
    54
    #                                                False))))
18033
00ac420f24ee perf: add option to perfstatus to get the status of unknown files
Siddharth Agarwal <sid0@fb.com>
parents: 17780
diff changeset
    55
    timer(lambda: sum(map(len, repo.status(**opts))))
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    56
18871
a2d4ab4f575d perf: add a command to test addremove performance
Siddharth Agarwal <sid0@fb.com>
parents: 18845
diff changeset
    57
@command('perfaddremove')
a2d4ab4f575d perf: add a command to test addremove performance
Siddharth Agarwal <sid0@fb.com>
parents: 18845
diff changeset
    58
def perfaddremove(ui, repo):
a2d4ab4f575d perf: add a command to test addremove performance
Siddharth Agarwal <sid0@fb.com>
parents: 18845
diff changeset
    59
    try:
a2d4ab4f575d perf: add a command to test addremove performance
Siddharth Agarwal <sid0@fb.com>
parents: 18845
diff changeset
    60
        oldquiet = repo.ui.quiet
a2d4ab4f575d perf: add a command to test addremove performance
Siddharth Agarwal <sid0@fb.com>
parents: 18845
diff changeset
    61
        repo.ui.quiet = True
a2d4ab4f575d perf: add a command to test addremove performance
Siddharth Agarwal <sid0@fb.com>
parents: 18845
diff changeset
    62
        timer(lambda: scmutil.addremove(repo, dry_run=True))
a2d4ab4f575d perf: add a command to test addremove performance
Siddharth Agarwal <sid0@fb.com>
parents: 18845
diff changeset
    63
    finally:
a2d4ab4f575d perf: add a command to test addremove performance
Siddharth Agarwal <sid0@fb.com>
parents: 18845
diff changeset
    64
        repo.ui.quiet = oldquiet
a2d4ab4f575d perf: add a command to test addremove performance
Siddharth Agarwal <sid0@fb.com>
parents: 18845
diff changeset
    65
16785
1dc08dc63c09 perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents: 16689
diff changeset
    66
def clearcaches(cl):
1dc08dc63c09 perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents: 16689
diff changeset
    67
    # behave somewhat consistently across internal API changes
1dc08dc63c09 perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents: 16689
diff changeset
    68
    if util.safehasattr(cl, 'clearcaches'):
1dc08dc63c09 perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents: 16689
diff changeset
    69
        cl.clearcaches()
1dc08dc63c09 perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents: 16689
diff changeset
    70
    elif util.safehasattr(cl, '_nodecache'):
1dc08dc63c09 perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents: 16689
diff changeset
    71
        from mercurial.node import nullid, nullrev
1dc08dc63c09 perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents: 16689
diff changeset
    72
        cl._nodecache = {nullid: nullrev}
1dc08dc63c09 perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents: 16689
diff changeset
    73
        cl._nodepos = None
1dc08dc63c09 perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents: 16689
diff changeset
    74
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
    75
@command('perfheads')
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    76
def perfheads(ui, repo):
16785
1dc08dc63c09 perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents: 16689
diff changeset
    77
    cl = repo.changelog
1dc08dc63c09 perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents: 16689
diff changeset
    78
    def d():
1dc08dc63c09 perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents: 16689
diff changeset
    79
        len(cl.headrevs())
1dc08dc63c09 perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents: 16689
diff changeset
    80
        clearcaches(cl)
1dc08dc63c09 perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents: 16689
diff changeset
    81
    timer(d)
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    82
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
    83
@command('perftags')
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    84
def perftags(ui, repo):
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    85
    import mercurial.changelog, mercurial.manifest
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    86
    def t():
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    87
        repo.changelog = mercurial.changelog.changelog(repo.sopener)
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    88
        repo.manifest = mercurial.manifest.manifest(repo.sopener)
9146
5614a628d173 localrepo: rename in-memory tag cache instance attributes (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 8873
diff changeset
    89
        repo._tags = None
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    90
        return len(repo.tags())
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    91
    timer(t)
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    92
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
    93
@command('perfancestors')
16802
7e5d94381cd1 perf: add a perfancestors benchmark
Bryan O'Sullivan <bryano@fb.com>
parents: 16788
diff changeset
    94
def perfancestors(ui, repo):
7e5d94381cd1 perf: add a perfancestors benchmark
Bryan O'Sullivan <bryano@fb.com>
parents: 16788
diff changeset
    95
    heads = repo.changelog.headrevs()
7e5d94381cd1 perf: add a perfancestors benchmark
Bryan O'Sullivan <bryano@fb.com>
parents: 16788
diff changeset
    96
    def d():
16866
91f3ac205816 revlog: ancestors(*revs) becomes ancestors(revs) (API)
Bryan O'Sullivan <bryano@fb.com>
parents: 16858
diff changeset
    97
        for a in repo.changelog.ancestors(heads):
16802
7e5d94381cd1 perf: add a perfancestors benchmark
Bryan O'Sullivan <bryano@fb.com>
parents: 16788
diff changeset
    98
            pass
7e5d94381cd1 perf: add a perfancestors benchmark
Bryan O'Sullivan <bryano@fb.com>
parents: 16788
diff changeset
    99
    timer(d)
7e5d94381cd1 perf: add a perfancestors benchmark
Bryan O'Sullivan <bryano@fb.com>
parents: 16788
diff changeset
   100
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   101
@command('perfancestorset')
18080
486bfb200b3f perf: add command to test performance of membership in ancestor set
Siddharth Agarwal <sid0@fb.com>
parents: 18062
diff changeset
   102
def perfancestorset(ui, repo, revset):
486bfb200b3f perf: add command to test performance of membership in ancestor set
Siddharth Agarwal <sid0@fb.com>
parents: 18062
diff changeset
   103
    revs = repo.revs(revset)
486bfb200b3f perf: add command to test performance of membership in ancestor set
Siddharth Agarwal <sid0@fb.com>
parents: 18062
diff changeset
   104
    heads = repo.changelog.headrevs()
486bfb200b3f perf: add command to test performance of membership in ancestor set
Siddharth Agarwal <sid0@fb.com>
parents: 18062
diff changeset
   105
    def d():
18091
f7f8159caad3 ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents: 18080
diff changeset
   106
        s = repo.changelog.ancestors(heads)
18080
486bfb200b3f perf: add command to test performance of membership in ancestor set
Siddharth Agarwal <sid0@fb.com>
parents: 18062
diff changeset
   107
        for rev in revs:
486bfb200b3f perf: add command to test performance of membership in ancestor set
Siddharth Agarwal <sid0@fb.com>
parents: 18062
diff changeset
   108
            rev in s
486bfb200b3f perf: add command to test performance of membership in ancestor set
Siddharth Agarwal <sid0@fb.com>
parents: 18062
diff changeset
   109
    timer(d)
486bfb200b3f perf: add command to test performance of membership in ancestor set
Siddharth Agarwal <sid0@fb.com>
parents: 18062
diff changeset
   110
18845
c1f416e4bc80 perf: add perfdirs command
Bryan O'Sullivan <bryano@fb.com>
parents: 18837
diff changeset
   111
@command('perfdirs')
c1f416e4bc80 perf: add perfdirs command
Bryan O'Sullivan <bryano@fb.com>
parents: 18837
diff changeset
   112
def perfdirs(ui, repo):
c1f416e4bc80 perf: add perfdirs command
Bryan O'Sullivan <bryano@fb.com>
parents: 18837
diff changeset
   113
    dirstate = repo.dirstate
c1f416e4bc80 perf: add perfdirs command
Bryan O'Sullivan <bryano@fb.com>
parents: 18837
diff changeset
   114
    'a' in dirstate
c1f416e4bc80 perf: add perfdirs command
Bryan O'Sullivan <bryano@fb.com>
parents: 18837
diff changeset
   115
    def d():
c1f416e4bc80 perf: add perfdirs command
Bryan O'Sullivan <bryano@fb.com>
parents: 18837
diff changeset
   116
        dirstate.dirs()
c1f416e4bc80 perf: add perfdirs command
Bryan O'Sullivan <bryano@fb.com>
parents: 18837
diff changeset
   117
        del dirstate._dirs
c1f416e4bc80 perf: add perfdirs command
Bryan O'Sullivan <bryano@fb.com>
parents: 18837
diff changeset
   118
    timer(d)
c1f416e4bc80 perf: add perfdirs command
Bryan O'Sullivan <bryano@fb.com>
parents: 18837
diff changeset
   119
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   120
@command('perfdirstate')
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   121
def perfdirstate(ui, repo):
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   122
    "a" in repo.dirstate
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   123
    def d():
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   124
        repo.dirstate.invalidate()
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   125
        "a" in repo.dirstate
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   126
    timer(d)
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   127
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   128
@command('perfdirstatedirs')
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   129
def perfdirstatedirs(ui, repo):
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   130
    "a" in repo.dirstate
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   131
    def d():
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   132
        "a" in repo.dirstate._dirs
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   133
        del repo.dirstate._dirs
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   134
    timer(d)
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   135
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   136
@command('perfdirstatewrite')
16788
7e72c1609862 perf: add a perfdirstatewrite benchmark
Bryan O'Sullivan <bryano@fb.com>
parents: 16785
diff changeset
   137
def perfdirstatewrite(ui, repo):
7e72c1609862 perf: add a perfdirstatewrite benchmark
Bryan O'Sullivan <bryano@fb.com>
parents: 16785
diff changeset
   138
    ds = repo.dirstate
7e72c1609862 perf: add a perfdirstatewrite benchmark
Bryan O'Sullivan <bryano@fb.com>
parents: 16785
diff changeset
   139
    "a" in ds
7e72c1609862 perf: add a perfdirstatewrite benchmark
Bryan O'Sullivan <bryano@fb.com>
parents: 16785
diff changeset
   140
    def d():
7e72c1609862 perf: add a perfdirstatewrite benchmark
Bryan O'Sullivan <bryano@fb.com>
parents: 16785
diff changeset
   141
        ds._dirty = True
7e72c1609862 perf: add a perfdirstatewrite benchmark
Bryan O'Sullivan <bryano@fb.com>
parents: 16785
diff changeset
   142
        ds.write()
7e72c1609862 perf: add a perfdirstatewrite benchmark
Bryan O'Sullivan <bryano@fb.com>
parents: 16785
diff changeset
   143
    timer(d)
7e72c1609862 perf: add a perfdirstatewrite benchmark
Bryan O'Sullivan <bryano@fb.com>
parents: 16785
diff changeset
   144
18817
c760acc6f69d perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents: 18644
diff changeset
   145
@command('perfmergecalculate',
c760acc6f69d perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents: 18644
diff changeset
   146
         [('r', 'rev', '.', 'rev to merge against')])
c760acc6f69d perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents: 18644
diff changeset
   147
def perfmergecalculate(ui, repo, rev):
c760acc6f69d perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents: 18644
diff changeset
   148
    wctx = repo[None]
c760acc6f69d perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents: 18644
diff changeset
   149
    rctx = scmutil.revsingle(repo, rev, rev)
c760acc6f69d perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents: 18644
diff changeset
   150
    ancestor = wctx.ancestor(rctx)
c760acc6f69d perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents: 18644
diff changeset
   151
    # we don't want working dir files to be stat'd in the benchmark, so prime
c760acc6f69d perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents: 18644
diff changeset
   152
    # that cache
c760acc6f69d perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents: 18644
diff changeset
   153
    wctx.dirty()
c760acc6f69d perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents: 18644
diff changeset
   154
    def d():
c760acc6f69d perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents: 18644
diff changeset
   155
        # acceptremote is True because we don't want prompts in the middle of
c760acc6f69d perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents: 18644
diff changeset
   156
        # our benchmark
c760acc6f69d perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents: 18644
diff changeset
   157
        merge.calculateupdates(repo, wctx, rctx, ancestor, False, False, False,
c760acc6f69d perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents: 18644
diff changeset
   158
                               acceptremote=True)
c760acc6f69d perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents: 18644
diff changeset
   159
    timer(d)
c760acc6f69d perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents: 18644
diff changeset
   160
18877
2e9fe9e2671f perf: add a command to test copies.pathcopies perf
Siddharth Agarwal <sid0@fb.com>
parents: 18871
diff changeset
   161
@command('perfpathcopies', [], "REV REV")
2e9fe9e2671f perf: add a command to test copies.pathcopies perf
Siddharth Agarwal <sid0@fb.com>
parents: 18871
diff changeset
   162
def perfpathcopies(ui, repo, rev1, rev2):
2e9fe9e2671f perf: add a command to test copies.pathcopies perf
Siddharth Agarwal <sid0@fb.com>
parents: 18871
diff changeset
   163
    ctx1 = scmutil.revsingle(repo, rev1, rev1)
2e9fe9e2671f perf: add a command to test copies.pathcopies perf
Siddharth Agarwal <sid0@fb.com>
parents: 18871
diff changeset
   164
    ctx2 = scmutil.revsingle(repo, rev2, rev2)
2e9fe9e2671f perf: add a command to test copies.pathcopies perf
Siddharth Agarwal <sid0@fb.com>
parents: 18871
diff changeset
   165
    def d():
2e9fe9e2671f perf: add a command to test copies.pathcopies perf
Siddharth Agarwal <sid0@fb.com>
parents: 18871
diff changeset
   166
        copies.pathcopies(ctx1, ctx2)
2e9fe9e2671f perf: add a command to test copies.pathcopies perf
Siddharth Agarwal <sid0@fb.com>
parents: 18871
diff changeset
   167
    timer(d)
2e9fe9e2671f perf: add a command to test copies.pathcopies perf
Siddharth Agarwal <sid0@fb.com>
parents: 18871
diff changeset
   168
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   169
@command('perfmanifest')
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   170
def perfmanifest(ui, repo):
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   171
    def d():
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   172
        t = repo.manifest.tip()
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   173
        m = repo.manifest.read(t)
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   174
        repo.manifest.mapcache = None
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   175
        repo.manifest._cache = None
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   176
    timer(d)
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   177
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   178
@command('perfchangeset')
16262
bf7a6c3b2a4a perf: add perfchangeset to time changeset parsing
Matt Mackall <mpm@selenic.com>
parents: 16260
diff changeset
   179
def perfchangeset(ui, repo, rev):
bf7a6c3b2a4a perf: add perfchangeset to time changeset parsing
Matt Mackall <mpm@selenic.com>
parents: 16260
diff changeset
   180
    n = repo[rev].node()
bf7a6c3b2a4a perf: add perfchangeset to time changeset parsing
Matt Mackall <mpm@selenic.com>
parents: 16260
diff changeset
   181
    def d():
bf7a6c3b2a4a perf: add perfchangeset to time changeset parsing
Matt Mackall <mpm@selenic.com>
parents: 16260
diff changeset
   182
        c = repo.changelog.read(n)
16266
77d56a5e74a5 perf: add a changeset test
Matt Mackall <mpm@selenic.com>
parents: 16262
diff changeset
   183
        #repo.changelog._cache = None
16262
bf7a6c3b2a4a perf: add perfchangeset to time changeset parsing
Matt Mackall <mpm@selenic.com>
parents: 16260
diff changeset
   184
    timer(d)
bf7a6c3b2a4a perf: add perfchangeset to time changeset parsing
Matt Mackall <mpm@selenic.com>
parents: 16260
diff changeset
   185
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   186
@command('perfindex')
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   187
def perfindex(ui, repo):
13255
2696730ca233 perf: make perfindex results useful on hg with lazyparser
Matt Mackall <mpm@selenic.com>
parents: 13254
diff changeset
   188
    import mercurial.revlog
13277
9f707b297b0f perf: restore lazyindex hack
Matt Mackall <mpm@selenic.com>
parents: 13262
diff changeset
   189
    mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg
13254
5ef5eb1f3515 revlog: only build the nodemap on demand
Matt Mackall <mpm@selenic.com>
parents: 13253
diff changeset
   190
    n = repo["tip"].node()
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   191
    def d():
16260
33fcad3cfbbc perf: tweak tests for testing index performance improvements
Matt Mackall <mpm@selenic.com>
parents: 14671
diff changeset
   192
        cl = mercurial.revlog.revlog(repo.sopener, "00changelog.i")
33fcad3cfbbc perf: tweak tests for testing index performance improvements
Matt Mackall <mpm@selenic.com>
parents: 14671
diff changeset
   193
        cl.rev(n)
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   194
    timer(d)
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   195
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   196
@command('perfstartup')
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   197
def perfstartup(ui, repo):
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   198
    cmd = sys.argv[0]
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   199
    def d():
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   200
        os.system("HGRCPATH= %s version -q > /dev/null" % cmd)
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   201
    timer(d)
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   202
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   203
@command('perfparents')
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   204
def perfparents(ui, repo):
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   205
    nl = [repo.changelog.node(i) for i in xrange(1000)]
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   206
    def d():
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   207
        for n in nl:
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   208
            repo.changelog.parents(n)
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   209
    timer(d)
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   210
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   211
@command('perflookup')
7366
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   212
def perflookup(ui, repo, rev):
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   213
    timer(lambda: len(repo.lookup(rev)))
eb240755386d Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   214
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   215
@command('perfrevrange')
16858
fdf99e0f60f3 perf: add a benchmark for revrange
Bryan O'Sullivan <bryano@fb.com>
parents: 16802
diff changeset
   216
def perfrevrange(ui, repo, *specs):
fdf99e0f60f3 perf: add a benchmark for revrange
Bryan O'Sullivan <bryano@fb.com>
parents: 16802
diff changeset
   217
    revrange = scmutil.revrange
fdf99e0f60f3 perf: add a benchmark for revrange
Bryan O'Sullivan <bryano@fb.com>
parents: 16802
diff changeset
   218
    timer(lambda: len(revrange(repo, specs)))
fdf99e0f60f3 perf: add a benchmark for revrange
Bryan O'Sullivan <bryano@fb.com>
parents: 16802
diff changeset
   219
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   220
@command('perfnodelookup')
16309
e0c1b3ef7c36 perf: node lookup
Matt Mackall <mpm@selenic.com>
parents: 16266
diff changeset
   221
def perfnodelookup(ui, repo, rev):
e0c1b3ef7c36 perf: node lookup
Matt Mackall <mpm@selenic.com>
parents: 16266
diff changeset
   222
    import mercurial.revlog
e0c1b3ef7c36 perf: node lookup
Matt Mackall <mpm@selenic.com>
parents: 16266
diff changeset
   223
    mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg
e0c1b3ef7c36 perf: node lookup
Matt Mackall <mpm@selenic.com>
parents: 16266
diff changeset
   224
    n = repo[rev].node()
16414
e8d37b78acfb parsers: use base-16 trie for faster node->rev mapping
Bryan O'Sullivan <bryano@fb.com>
parents: 16403
diff changeset
   225
    cl = mercurial.revlog.revlog(repo.sopener, "00changelog.i")
e8d37b78acfb parsers: use base-16 trie for faster node->rev mapping
Bryan O'Sullivan <bryano@fb.com>
parents: 16403
diff changeset
   226
    def d():
e8d37b78acfb parsers: use base-16 trie for faster node->rev mapping
Bryan O'Sullivan <bryano@fb.com>
parents: 16403
diff changeset
   227
        cl.rev(n)
16785
1dc08dc63c09 perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents: 16689
diff changeset
   228
        clearcaches(cl)
16414
e8d37b78acfb parsers: use base-16 trie for faster node->rev mapping
Bryan O'Sullivan <bryano@fb.com>
parents: 16403
diff changeset
   229
    timer(d)
e8d37b78acfb parsers: use base-16 trie for faster node->rev mapping
Bryan O'Sullivan <bryano@fb.com>
parents: 16403
diff changeset
   230
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   231
@command('perflog',
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   232
         [('', 'rename', False, 'ask log to follow renames')])
9932
2fcbef9a349a perf.perflog: add option to follow renames
Alexander Solovyov <piranha@piranha.org.ua>
parents: 9826
diff changeset
   233
def perflog(ui, repo, **opts):
7872
f680a1bd679b contrib: add perflog and perftemplating commands to perf extension
Alexander Solovyov <piranha@piranha.org.ua>
parents: 7366
diff changeset
   234
    ui.pushbuffer()
9932
2fcbef9a349a perf.perflog: add option to follow renames
Alexander Solovyov <piranha@piranha.org.ua>
parents: 9826
diff changeset
   235
    timer(lambda: commands.log(ui, repo, rev=[], date='', user='',
2fcbef9a349a perf.perflog: add option to follow renames
Alexander Solovyov <piranha@piranha.org.ua>
parents: 9826
diff changeset
   236
                               copies=opts.get('rename')))
7872
f680a1bd679b contrib: add perflog and perftemplating commands to perf extension
Alexander Solovyov <piranha@piranha.org.ua>
parents: 7366
diff changeset
   237
    ui.popbuffer()
f680a1bd679b contrib: add perflog and perftemplating commands to perf extension
Alexander Solovyov <piranha@piranha.org.ua>
parents: 7366
diff changeset
   238
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   239
@command('perftemplating')
7872
f680a1bd679b contrib: add perflog and perftemplating commands to perf extension
Alexander Solovyov <piranha@piranha.org.ua>
parents: 7366
diff changeset
   240
def perftemplating(ui, repo):
f680a1bd679b contrib: add perflog and perftemplating commands to perf extension
Alexander Solovyov <piranha@piranha.org.ua>
parents: 7366
diff changeset
   241
    ui.pushbuffer()
f680a1bd679b contrib: add perflog and perftemplating commands to perf extension
Alexander Solovyov <piranha@piranha.org.ua>
parents: 7366
diff changeset
   242
    timer(lambda: commands.log(ui, repo, rev=[], date='', user='',
f680a1bd679b contrib: add perflog and perftemplating commands to perf extension
Alexander Solovyov <piranha@piranha.org.ua>
parents: 7366
diff changeset
   243
                               template='{date|shortdate} [{rev}:{node|short}]'
f680a1bd679b contrib: add perflog and perftemplating commands to perf extension
Alexander Solovyov <piranha@piranha.org.ua>
parents: 7366
diff changeset
   244
                               ' {author|person}: {desc|firstline}\n'))
f680a1bd679b contrib: add perflog and perftemplating commands to perf extension
Alexander Solovyov <piranha@piranha.org.ua>
parents: 7366
diff changeset
   245
    ui.popbuffer()
f680a1bd679b contrib: add perflog and perftemplating commands to perf extension
Alexander Solovyov <piranha@piranha.org.ua>
parents: 7366
diff changeset
   246
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   247
@command('perfcca')
16386
ccc173d0914e perf: add case collision auditor perf
Matt Mackall <mpm@selenic.com>
parents: 16309
diff changeset
   248
def perfcca(ui, repo):
17216
01c1ee4bd1dd perf: fix perfcca to work with new casecollisionauditor interface
Joshua Redstone <joshua.redstone@fb.com>
parents: 16866
diff changeset
   249
    timer(lambda: scmutil.casecollisionauditor(ui, False, repo.dirstate))
16386
ccc173d0914e perf: add case collision auditor perf
Matt Mackall <mpm@selenic.com>
parents: 16309
diff changeset
   250
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   251
@command('perffncacheload')
16403
efae1fea4bbd perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents: 16386
diff changeset
   252
def perffncacheload(ui, repo):
17780
769f66861eb8 perf: simply use repo.store for perffncache* commands
Adrian Buehlmann <adrian@cadifra.com>
parents: 17553
diff changeset
   253
    s = repo.store
16403
efae1fea4bbd perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents: 16386
diff changeset
   254
    def d():
efae1fea4bbd perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents: 16386
diff changeset
   255
        s.fncache._load()
efae1fea4bbd perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents: 16386
diff changeset
   256
    timer(d)
efae1fea4bbd perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents: 16386
diff changeset
   257
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   258
@command('perffncachewrite')
16403
efae1fea4bbd perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents: 16386
diff changeset
   259
def perffncachewrite(ui, repo):
17780
769f66861eb8 perf: simply use repo.store for perffncache* commands
Adrian Buehlmann <adrian@cadifra.com>
parents: 17553
diff changeset
   260
    s = repo.store
16403
efae1fea4bbd perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents: 16386
diff changeset
   261
    s.fncache._load()
efae1fea4bbd perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents: 16386
diff changeset
   262
    def d():
efae1fea4bbd perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents: 16386
diff changeset
   263
        s.fncache._dirty = True
efae1fea4bbd perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents: 16386
diff changeset
   264
        s.fncache.write()
efae1fea4bbd perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents: 16386
diff changeset
   265
    timer(d)
efae1fea4bbd perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents: 16386
diff changeset
   266
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   267
@command('perffncacheencode')
17553
5ab863922e0f perf: add perffncacheencode
Adrian Buehlmann <adrian@cadifra.com>
parents: 17216
diff changeset
   268
def perffncacheencode(ui, repo):
17780
769f66861eb8 perf: simply use repo.store for perffncache* commands
Adrian Buehlmann <adrian@cadifra.com>
parents: 17553
diff changeset
   269
    s = repo.store
17553
5ab863922e0f perf: add perffncacheencode
Adrian Buehlmann <adrian@cadifra.com>
parents: 17216
diff changeset
   270
    s.fncache._load()
5ab863922e0f perf: add perffncacheencode
Adrian Buehlmann <adrian@cadifra.com>
parents: 17216
diff changeset
   271
    def d():
5ab863922e0f perf: add perffncacheencode
Adrian Buehlmann <adrian@cadifra.com>
parents: 17216
diff changeset
   272
        for p in s.fncache.entries:
5ab863922e0f perf: add perffncacheencode
Adrian Buehlmann <adrian@cadifra.com>
parents: 17216
diff changeset
   273
            s.encode(p)
5ab863922e0f perf: add perffncacheencode
Adrian Buehlmann <adrian@cadifra.com>
parents: 17216
diff changeset
   274
    timer(d)
5ab863922e0f perf: add perffncacheencode
Adrian Buehlmann <adrian@cadifra.com>
parents: 17216
diff changeset
   275
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   276
@command('perfdiffwd')
9826
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
   277
def perfdiffwd(ui, repo):
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
   278
    """Profile diff of working directory changes"""
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
   279
    options = {
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
   280
        'w': 'ignore_all_space',
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
   281
        'b': 'ignore_space_change',
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
   282
        'B': 'ignore_blank_lines',
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
   283
        }
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
   284
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
   285
    for diffopt in ('', 'w', 'b', 'B', 'wB'):
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
   286
        opts = dict((options[c], '1') for c in diffopt)
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
   287
        def d():
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
   288
            ui.pushbuffer()
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
   289
            commands.diff(ui, repo, **opts)
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
   290
            ui.popbuffer()
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
   291
        title = 'diffopts: %s' % (diffopt and ('-' + diffopt) or 'none')
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
   292
        timer(d, title)
d768614578dd contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents: 9146
diff changeset
   293
18237
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   294
@command('perfrevlog',
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   295
         [('d', 'dist', 100, 'distance between the revisions')],
4132dc9bd5c4 perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 18236
diff changeset
   296
         "[INDEXFILE]")
11694
bf49d48e4602 perf: add perfrevlog function to check performance of revlog
Pradeepkumar Gayam <in3xes@gmail.com>
parents: 10493
diff changeset
   297
def perfrevlog(ui, repo, file_, **opts):
bf49d48e4602 perf: add perfrevlog function to check performance of revlog
Pradeepkumar Gayam <in3xes@gmail.com>
parents: 10493
diff changeset
   298
    from mercurial import revlog
bf49d48e4602 perf: add perfrevlog function to check performance of revlog
Pradeepkumar Gayam <in3xes@gmail.com>
parents: 10493
diff changeset
   299
    dist = opts['dist']
bf49d48e4602 perf: add perfrevlog function to check performance of revlog
Pradeepkumar Gayam <in3xes@gmail.com>
parents: 10493
diff changeset
   300
    def d():
bf49d48e4602 perf: add perfrevlog function to check performance of revlog
Pradeepkumar Gayam <in3xes@gmail.com>
parents: 10493
diff changeset
   301
        r = revlog.revlog(lambda fn: open(fn, 'rb'), file_)
bf49d48e4602 perf: add perfrevlog function to check performance of revlog
Pradeepkumar Gayam <in3xes@gmail.com>
parents: 10493
diff changeset
   302
        for x in xrange(0, len(r), dist):
bf49d48e4602 perf: add perfrevlog function to check performance of revlog
Pradeepkumar Gayam <in3xes@gmail.com>
parents: 10493
diff changeset
   303
            r.revision(r.node(x))
bf49d48e4602 perf: add perfrevlog function to check performance of revlog
Pradeepkumar Gayam <in3xes@gmail.com>
parents: 10493
diff changeset
   304
bf49d48e4602 perf: add perfrevlog function to check performance of revlog
Pradeepkumar Gayam <in3xes@gmail.com>
parents: 10493
diff changeset
   305
    timer(d)
bf49d48e4602 perf: add perfrevlog function to check performance of revlog
Pradeepkumar Gayam <in3xes@gmail.com>
parents: 10493
diff changeset
   306
18239
a95f1d619bb7 perftest: add an option to invalidate volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18238
diff changeset
   307
@command('perfrevset',
a95f1d619bb7 perftest: add an option to invalidate volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18238
diff changeset
   308
         [('C', 'clear', False, 'clear volatile cache between each call.')],
18238
1f991e625d01 perftest: document the perfrevset command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18237
diff changeset
   309
         "REVSET")
18239
a95f1d619bb7 perftest: add an option to invalidate volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18238
diff changeset
   310
def perfrevset(ui, repo, expr, clear=False):
a95f1d619bb7 perftest: add an option to invalidate volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18238
diff changeset
   311
    """benchmark the execution time of a revset
a95f1d619bb7 perftest: add an option to invalidate volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18238
diff changeset
   312
18644
3e92772d5383 spelling: fix some minor issues found by spell checker
Mads Kiilerich <mads@kiilerich.com>
parents: 18304
diff changeset
   313
    Use the --clean option if need to evaluate the impact of build volatile
18239
a95f1d619bb7 perftest: add an option to invalidate volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18238
diff changeset
   314
    revisions set cache on the revset execution. Volatile cache hold filtered
a95f1d619bb7 perftest: add an option to invalidate volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18238
diff changeset
   315
    and obsolete related cache."""
18062
1471f5e83686 perf: add a command to measure revset performance
Siddharth Agarwal <sid0@fb.com>
parents: 18033
diff changeset
   316
    def d():
18239
a95f1d619bb7 perftest: add an option to invalidate volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18238
diff changeset
   317
        if clear:
a95f1d619bb7 perftest: add an option to invalidate volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18238
diff changeset
   318
            repo.invalidatevolatilesets()
18062
1471f5e83686 perf: add a command to measure revset performance
Siddharth Agarwal <sid0@fb.com>
parents: 18033
diff changeset
   319
        repo.revs(expr)
1471f5e83686 perf: add a command to measure revset performance
Siddharth Agarwal <sid0@fb.com>
parents: 18033
diff changeset
   320
    timer(d)
18240
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   321
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   322
@command('perfvolatilesets')
18241
f5ed27c51995 perftest: allow selection of volatile set to benchmark
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18240
diff changeset
   323
def perfvolatilesets(ui, repo, *names):
18240
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   324
    """benchmark the computation of various volatile set
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   325
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   326
    Volatile set computes element related to filtering and obsolescence."""
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   327
    repo = repo.unfiltered()
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   328
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   329
    def getobs(name):
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   330
        def d():
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   331
            repo.invalidatevolatilesets()
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   332
            obsolete.getrevs(repo, name)
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   333
        return d
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   334
18241
f5ed27c51995 perftest: allow selection of volatile set to benchmark
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18240
diff changeset
   335
    allobs = sorted(obsolete.cachefuncs)
f5ed27c51995 perftest: allow selection of volatile set to benchmark
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18240
diff changeset
   336
    if names:
f5ed27c51995 perftest: allow selection of volatile set to benchmark
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18240
diff changeset
   337
        allobs = [n for n in allobs if n in names]
f5ed27c51995 perftest: allow selection of volatile set to benchmark
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18240
diff changeset
   338
f5ed27c51995 perftest: allow selection of volatile set to benchmark
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18240
diff changeset
   339
    for name in allobs:
18240
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   340
        timer(getobs(name), title=name)
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   341
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   342
    def getfiltered(name):
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   343
        def d():
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   344
            repo.invalidatevolatilesets()
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   345
            repoview.filteredrevs(repo, name)
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   346
        return d
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   347
18241
f5ed27c51995 perftest: allow selection of volatile set to benchmark
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18240
diff changeset
   348
    allfilter = sorted(repoview.filtertable)
f5ed27c51995 perftest: allow selection of volatile set to benchmark
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18240
diff changeset
   349
    if names:
f5ed27c51995 perftest: allow selection of volatile set to benchmark
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18240
diff changeset
   350
        allfilter = [n for n in allfilter if n in names]
f5ed27c51995 perftest: allow selection of volatile set to benchmark
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18240
diff changeset
   351
f5ed27c51995 perftest: allow selection of volatile set to benchmark
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18240
diff changeset
   352
    for name in allfilter:
18240
a8318715d8bb perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18239
diff changeset
   353
        timer(getfiltered(name), title=name)
18304
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   354
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   355
@command('perfbranchmap',
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   356
         [('f', 'full', False,
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   357
           'Includes build time of subset'),
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   358
         ])
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   359
def perfbranchmap(ui, repo, full=False):
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   360
    """benchmark the update of a branchmap
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   361
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   362
    This benchmarks the full repo.branchmap() call with read and write disabled
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   363
    """
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   364
    def getbranchmap(filtername):
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   365
        """generate a benchmark function for the filtername"""
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   366
        if filtername is None:
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   367
            view = repo
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   368
        else:
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   369
            view = repo.filtered(filtername)
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   370
        def d():
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   371
            if full:
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   372
                view._branchcaches.clear()
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   373
            else:
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   374
                view._branchcaches.pop(filtername, None)
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   375
            view.branchmap()
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   376
        return d
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   377
    # add filter in smaller subset to bigger subset
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   378
    possiblefilters = set(repoview.filtertable)
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   379
    allfilters = []
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   380
    while possiblefilters:
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   381
        for name in possiblefilters:
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   382
            subset = repoview.subsettable.get(name)
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   383
            if subset not in possiblefilters:
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   384
                break
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   385
        else:
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   386
            assert False, 'subset cycle %s!' % possiblefilters
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   387
        allfilters.append(name)
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   388
        possiblefilters.remove(name)
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   389
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   390
    # warm the cache
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   391
    if not full:
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   392
        for name in allfilters:
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   393
            repo.filtered(name).branchmap()
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   394
    # add unfiltered
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   395
    allfilters.append(None)
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   396
    oldread = branchmap.read
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   397
    oldwrite = branchmap.branchcache.write
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   398
    try:
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   399
        branchmap.read = lambda repo: None
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   400
        branchmap.write = lambda repo: None
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   401
        for name in allfilters:
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   402
            timer(getbranchmap(name), title=str(name))
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   403
    finally:
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   404
        branchmap.read = oldread
9b6ae29d4801 perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 18241
diff changeset
   405
        branchmap.branchcache.write = oldwrite