Mercurial > hg
annotate contrib/perf.py @ 29758:2372182e505b
match: added matchessubrepo method to matcher
Previously there were three local implementations of this
function in cmdutil.files, cmdutil.remove and scmutil.addremove.
author | Hannes Oldenburg <hannes.christian.oldenburg@gmail.com> |
---|---|
date | Tue, 09 Aug 2016 09:02:51 +0000 |
parents | 7e2b389418da |
children | 973cf6c3de30 |
rev | line source |
---|---|
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 |
29493
4533f5b47949
perf: add historical portability policy for future reference
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28561
diff
changeset
|
4 # "historical portability" policy of perf.py: |
4533f5b47949
perf: add historical portability policy for future reference
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28561
diff
changeset
|
5 # |
4533f5b47949
perf: add historical portability policy for future reference
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28561
diff
changeset
|
6 # We have to do: |
4533f5b47949
perf: add historical portability policy for future reference
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28561
diff
changeset
|
7 # - make perf.py "loadable" with as wide Mercurial version as possible |
4533f5b47949
perf: add historical portability policy for future reference
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28561
diff
changeset
|
8 # This doesn't mean that perf commands work correctly with that Mercurial. |
4533f5b47949
perf: add historical portability policy for future reference
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28561
diff
changeset
|
9 # BTW, perf.py itself has been available since 1.1 (or eb240755386d). |
4533f5b47949
perf: add historical portability policy for future reference
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28561
diff
changeset
|
10 # - make historical perf command work correctly with as wide Mercurial |
4533f5b47949
perf: add historical portability policy for future reference
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28561
diff
changeset
|
11 # version as possible |
4533f5b47949
perf: add historical portability policy for future reference
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28561
diff
changeset
|
12 # |
4533f5b47949
perf: add historical portability policy for future reference
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28561
diff
changeset
|
13 # We have to do, if possible with reasonable cost: |
4533f5b47949
perf: add historical portability policy for future reference
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28561
diff
changeset
|
14 # - make recent perf command for historical feature work correctly |
4533f5b47949
perf: add historical portability policy for future reference
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28561
diff
changeset
|
15 # with early Mercurial |
4533f5b47949
perf: add historical portability policy for future reference
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28561
diff
changeset
|
16 # |
4533f5b47949
perf: add historical portability policy for future reference
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28561
diff
changeset
|
17 # We don't have to do: |
4533f5b47949
perf: add historical portability policy for future reference
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28561
diff
changeset
|
18 # - make perf command for recent feature work correctly with early |
4533f5b47949
perf: add historical portability policy for future reference
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28561
diff
changeset
|
19 # Mercurial |
4533f5b47949
perf: add historical portability policy for future reference
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28561
diff
changeset
|
20 |
28561
330584235c22
contrib: make perf.py use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27649
diff
changeset
|
21 from __future__ import absolute_import |
330584235c22
contrib: make perf.py use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27649
diff
changeset
|
22 import functools |
330584235c22
contrib: make perf.py use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27649
diff
changeset
|
23 import os |
27286
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
24 import random |
28561
330584235c22
contrib: make perf.py use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27649
diff
changeset
|
25 import sys |
330584235c22
contrib: make perf.py use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27649
diff
changeset
|
26 import time |
330584235c22
contrib: make perf.py use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27649
diff
changeset
|
27 from mercurial import ( |
330584235c22
contrib: make perf.py use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27649
diff
changeset
|
28 cmdutil, |
330584235c22
contrib: make perf.py use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27649
diff
changeset
|
29 commands, |
330584235c22
contrib: make perf.py use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27649
diff
changeset
|
30 copies, |
330584235c22
contrib: make perf.py use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27649
diff
changeset
|
31 error, |
29495
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
32 extensions, |
28561
330584235c22
contrib: make perf.py use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27649
diff
changeset
|
33 mdiff, |
330584235c22
contrib: make perf.py use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27649
diff
changeset
|
34 merge, |
330584235c22
contrib: make perf.py use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27649
diff
changeset
|
35 revlog, |
330584235c22
contrib: make perf.py use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27649
diff
changeset
|
36 util, |
330584235c22
contrib: make perf.py use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27649
diff
changeset
|
37 ) |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
38 |
29494
3b5389ef5cfe
perf: define util.safehasattr forcibly for Mercurial earlier than 1.9.3
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29493
diff
changeset
|
39 # for "historical portability": |
29567
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
40 # try to import modules separately (in dict order), and ignore |
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
41 # failure, because these aren't available with early Mercurial |
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
42 try: |
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
43 from mercurial import branchmap # since 2.5 (or bcee63733aad) |
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
44 except ImportError: |
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
45 pass |
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
46 try: |
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
47 from mercurial import obsolete # since 2.3 (or ad0d6c2b3279) |
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
48 except ImportError: |
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
49 pass |
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
50 try: |
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
51 from mercurial import repoview # since 2.5 (or 3a6ddacb7198) |
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
52 except ImportError: |
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
53 pass |
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
54 try: |
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
55 from mercurial import scmutil # since 1.9 (or 8b252e826c68) |
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
56 except ImportError: |
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
57 pass |
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
58 |
7e2b389418da
perf: import newer modules separately for earlier Mercurial
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29497
diff
changeset
|
59 # for "historical portability": |
29494
3b5389ef5cfe
perf: define util.safehasattr forcibly for Mercurial earlier than 1.9.3
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29493
diff
changeset
|
60 # define util.safehasattr forcibly, because util.safehasattr has been |
3b5389ef5cfe
perf: define util.safehasattr forcibly for Mercurial earlier than 1.9.3
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29493
diff
changeset
|
61 # available since 1.9.3 (or 94b200a11cf7) |
3b5389ef5cfe
perf: define util.safehasattr forcibly for Mercurial earlier than 1.9.3
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29493
diff
changeset
|
62 _undefined = object() |
3b5389ef5cfe
perf: define util.safehasattr forcibly for Mercurial earlier than 1.9.3
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29493
diff
changeset
|
63 def safehasattr(thing, attr): |
3b5389ef5cfe
perf: define util.safehasattr forcibly for Mercurial earlier than 1.9.3
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29493
diff
changeset
|
64 return getattr(thing, attr, _undefined) is not _undefined |
3b5389ef5cfe
perf: define util.safehasattr forcibly for Mercurial earlier than 1.9.3
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29493
diff
changeset
|
65 setattr(util, 'safehasattr', safehasattr) |
3b5389ef5cfe
perf: define util.safehasattr forcibly for Mercurial earlier than 1.9.3
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29493
diff
changeset
|
66 |
29496
7299370cf304
perf: avoid using formatteropts for Mercurial earlier than 3.2
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29495
diff
changeset
|
67 # for "historical portability": |
7299370cf304
perf: avoid using formatteropts for Mercurial earlier than 3.2
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29495
diff
changeset
|
68 # use locally defined empty option list, if formatteropts isn't |
7299370cf304
perf: avoid using formatteropts for Mercurial earlier than 3.2
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29495
diff
changeset
|
69 # available, because commands.formatteropts has been available since |
7299370cf304
perf: avoid using formatteropts for Mercurial earlier than 3.2
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29495
diff
changeset
|
70 # 3.2 (or 7a7eed5176a4), even though formatting itself has been |
7299370cf304
perf: avoid using formatteropts for Mercurial earlier than 3.2
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29495
diff
changeset
|
71 # available since 2.2 (or ae5f92e154d3) |
7299370cf304
perf: avoid using formatteropts for Mercurial earlier than 3.2
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29495
diff
changeset
|
72 formatteropts = getattr(commands, "formatteropts", []) |
29495
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
73 |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
74 # for "historical portability": |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
75 # use locally defined option list, if debugrevlogopts isn't available, |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
76 # because commands.debugrevlogopts has been available since 3.7 (or |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
77 # 5606f7d0d063), even though cmdutil.openrevlog() has been available |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
78 # since 1.9 (or a79fea6b3e77). |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
79 revlogopts = getattr(commands, "debugrevlogopts", [ |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
80 ('c', 'changelog', False, ('open changelog')), |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
81 ('m', 'manifest', False, ('open manifest')), |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
82 ('', 'dir', False, ('open directory manifest')), |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
83 ]) |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
84 |
18237
4132dc9bd5c4
perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
18236
diff
changeset
|
85 cmdtable = {} |
29497
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
86 |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
87 # for "historical portability": |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
88 # define parsealiases locally, because cmdutil.parsealiases has been |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
89 # available since 1.5 (or 6252852b4332) |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
90 def parsealiases(cmd): |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
91 return cmd.lstrip("^").split("|") |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
92 |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
93 if safehasattr(cmdutil, 'command'): |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
94 import inspect |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
95 command = cmdutil.command(cmdtable) |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
96 if 'norepo' not in inspect.getargspec(command)[0]: |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
97 # for "historical portability": |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
98 # wrap original cmdutil.command, because "norepo" option has |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
99 # been available since 3.1 (or 75a96326cecb) |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
100 _command = command |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
101 def command(name, options=(), synopsis=None, norepo=False): |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
102 if norepo: |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
103 commands.norepo += ' %s' % ' '.join(parsealiases(name)) |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
104 return _command(name, list(options), synopsis) |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
105 else: |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
106 # for "historical portability": |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
107 # define "@command" annotation locally, because cmdutil.command |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
108 # has been available since 1.9 (or 2daa5179e73f) |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
109 def command(name, options=(), synopsis=None, norepo=False): |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
110 def decorator(func): |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
111 if synopsis: |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
112 cmdtable[name] = func, list(options), synopsis |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
113 else: |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
114 cmdtable[name] = func, list(options) |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
115 if norepo: |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
116 commands.norepo += ' %s' % ' '.join(parsealiases(name)) |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
117 return func |
ee2027195847
perf: define command annotation locally for Mercurial earlier than 3.1
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29496
diff
changeset
|
118 return decorator |
18237
4132dc9bd5c4
perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
18236
diff
changeset
|
119 |
27307 | 120 def getlen(ui): |
121 if ui.configbool("perf", "stub"): | |
122 return lambda x: 1 | |
123 return len | |
124 | |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
125 def gettimer(ui, opts=None): |
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
126 """return a timer function and formatter: (timer, formatter) |
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
127 |
27303
57bd9c5431a5
perf: improve grammar of gettimer comment
timeless <timeless@mozdev.org>
parents:
27286
diff
changeset
|
128 This function exists to gather the creation of formatter in a single |
57bd9c5431a5
perf: improve grammar of gettimer comment
timeless <timeless@mozdev.org>
parents:
27286
diff
changeset
|
129 place instead of duplicating it in all performance commands.""" |
23788
316ad725a1dd
perf: add a configurable sleep on startup
Matt Mackall <mpm@selenic.com>
parents:
23537
diff
changeset
|
130 |
316ad725a1dd
perf: add a configurable sleep on startup
Matt Mackall <mpm@selenic.com>
parents:
23537
diff
changeset
|
131 # enforce an idle period before execution to counteract power management |
25850
b130764e3eb5
perf: mark experimental option presleep
Matt Mackall <mpm@selenic.com>
parents:
25494
diff
changeset
|
132 # experimental config: perf.presleep |
23788
316ad725a1dd
perf: add a configurable sleep on startup
Matt Mackall <mpm@selenic.com>
parents:
23537
diff
changeset
|
133 time.sleep(ui.configint("perf", "presleep", 1)) |
316ad725a1dd
perf: add a configurable sleep on startup
Matt Mackall <mpm@selenic.com>
parents:
23537
diff
changeset
|
134 |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
135 if opts is None: |
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
136 opts = {} |
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
137 # redirect all to stderr |
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
138 ui = ui.copy() |
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
139 ui.fout = ui.ferr |
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
140 # get a formatter |
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
141 fm = ui.formatter('perf', opts) |
27304
a6fd79495770
perf: offer perf.stub to only run one loop
timeless <timeless@mozdev.org>
parents:
27303
diff
changeset
|
142 # stub function, runs code only once instead of in a loop |
a6fd79495770
perf: offer perf.stub to only run one loop
timeless <timeless@mozdev.org>
parents:
27303
diff
changeset
|
143 # experimental config: perf.stub |
a6fd79495770
perf: offer perf.stub to only run one loop
timeless <timeless@mozdev.org>
parents:
27303
diff
changeset
|
144 if ui.configbool("perf", "stub"): |
a6fd79495770
perf: offer perf.stub to only run one loop
timeless <timeless@mozdev.org>
parents:
27303
diff
changeset
|
145 return functools.partial(stub_timer, fm), fm |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
146 return functools.partial(_timer, fm), fm |
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
147 |
27304
a6fd79495770
perf: offer perf.stub to only run one loop
timeless <timeless@mozdev.org>
parents:
27303
diff
changeset
|
148 def stub_timer(fm, func, title=None): |
a6fd79495770
perf: offer perf.stub to only run one loop
timeless <timeless@mozdev.org>
parents:
27303
diff
changeset
|
149 func() |
a6fd79495770
perf: offer perf.stub to only run one loop
timeless <timeless@mozdev.org>
parents:
27303
diff
changeset
|
150 |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
151 def _timer(fm, func, title=None): |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
152 results = [] |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
153 begin = time.time() |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
154 count = 0 |
14494
1ffeeb91c55d
check-code: flag 0/1 used as constant Boolean expression
Martin Geisler <mg@lazybytes.net>
parents:
14322
diff
changeset
|
155 while True: |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
156 ostart = os.times() |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
157 cstart = time.time() |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
158 r = func() |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
159 cstop = time.time() |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
160 ostop = os.times() |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
161 count += 1 |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
162 a, b = ostart, ostop |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
163 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
|
164 if cstop - begin > 3 and count >= 100: |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
165 break |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
166 if cstop - begin > 10 and count >= 3: |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
167 break |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
168 |
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
169 fm.startitem() |
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
170 |
9826
d768614578dd
contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents:
9146
diff
changeset
|
171 if title: |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
172 fm.write('title', '! %s\n', title) |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
173 if r: |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
174 fm.write('result', '! result: %s\n', r) |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
175 m = min(results) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
176 fm.plain('!') |
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
177 fm.write('wall', ' wall %f', m[0]) |
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
178 fm.write('comb', ' comb %f', m[1] + m[2]) |
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
179 fm.write('user', ' user %f', m[1]) |
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
180 fm.write('sys', ' sys %f', m[2]) |
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
181 fm.write('count', ' (best of %d)', count) |
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
182 fm.plain('\n') |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
183 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
184 @command('perfwalk', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
185 def perfwalk(ui, repo, *pats, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
186 timer, fm = gettimer(ui, opts) |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
187 try: |
14671
35c2cc322ba8
scmutil: switch match users to supplying contexts
Matt Mackall <mpm@selenic.com>
parents:
14494
diff
changeset
|
188 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
|
189 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
|
190 except Exception: |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
191 try: |
14671
35c2cc322ba8
scmutil: switch match users to supplying contexts
Matt Mackall <mpm@selenic.com>
parents:
14494
diff
changeset
|
192 m = scmutil.match(repo[None], pats, {}) |
10282
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10176
diff
changeset
|
193 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
|
194 except Exception: |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
195 timer(lambda: len(list(cmdutil.walk(repo, pats, {})))) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
196 fm.end() |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
197 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
198 @command('perfannotate', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
199 def perfannotate(ui, repo, f, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
200 timer, fm = gettimer(ui, opts) |
19292
e0aa6fff8f02
annotate: simplify annotate parent function
Durham Goode <durham@fb.com>
parents:
18877
diff
changeset
|
201 fc = repo['.'][f] |
e0aa6fff8f02
annotate: simplify annotate parent function
Durham Goode <durham@fb.com>
parents:
18877
diff
changeset
|
202 timer(lambda: len(fc.annotate(True))) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
203 fm.end() |
19292
e0aa6fff8f02
annotate: simplify annotate parent function
Durham Goode <durham@fb.com>
parents:
18877
diff
changeset
|
204 |
18237
4132dc9bd5c4
perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
18236
diff
changeset
|
205 @command('perfstatus', |
4132dc9bd5c4
perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
18236
diff
changeset
|
206 [('u', 'unknown', False, |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
207 'ask status to look for unknown files')] + formatteropts) |
18033
00ac420f24ee
perf: add option to perfstatus to get the status of unknown files
Siddharth Agarwal <sid0@fb.com>
parents:
17780
diff
changeset
|
208 def perfstatus(ui, repo, **opts): |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
209 #m = match.always(repo.root, repo.getcwd()) |
16683 | 210 #timer(lambda: sum(map(len, repo.dirstate.status(m, [], False, False, |
211 # False)))) | |
27017
cdc3e437b481
perf: un-bitrot perfstatus
Matt Mackall <mpm@selenic.com>
parents:
26748
diff
changeset
|
212 timer, fm = gettimer(ui, opts) |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
213 timer(lambda: sum(map(len, repo.status(unknown=opts['unknown'])))) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
214 fm.end() |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
215 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
216 @command('perfaddremove', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
217 def perfaddremove(ui, repo, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
218 timer, fm = gettimer(ui, opts) |
18871
a2d4ab4f575d
perf: add a command to test addremove performance
Siddharth Agarwal <sid0@fb.com>
parents:
18845
diff
changeset
|
219 try: |
a2d4ab4f575d
perf: add a command to test addremove performance
Siddharth Agarwal <sid0@fb.com>
parents:
18845
diff
changeset
|
220 oldquiet = repo.ui.quiet |
a2d4ab4f575d
perf: add a command to test addremove performance
Siddharth Agarwal <sid0@fb.com>
parents:
18845
diff
changeset
|
221 repo.ui.quiet = True |
23533
891aaa7c0c70
scmutil: pass a matcher to scmutil.addremove() instead of a list of patterns
Matt Harbison <matt_harbison@yahoo.com>
parents:
23485
diff
changeset
|
222 matcher = scmutil.match(repo[None]) |
23537
f1b06a8aad42
commit: propagate --addremove to subrepos if -S is specified (issue3759)
Matt Harbison <matt_harbison@yahoo.com>
parents:
23533
diff
changeset
|
223 timer(lambda: scmutil.addremove(repo, matcher, "", dry_run=True)) |
18871
a2d4ab4f575d
perf: add a command to test addremove performance
Siddharth Agarwal <sid0@fb.com>
parents:
18845
diff
changeset
|
224 finally: |
a2d4ab4f575d
perf: add a command to test addremove performance
Siddharth Agarwal <sid0@fb.com>
parents:
18845
diff
changeset
|
225 repo.ui.quiet = oldquiet |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
226 fm.end() |
18871
a2d4ab4f575d
perf: add a command to test addremove performance
Siddharth Agarwal <sid0@fb.com>
parents:
18845
diff
changeset
|
227 |
16785
1dc08dc63c09
perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents:
16689
diff
changeset
|
228 def clearcaches(cl): |
1dc08dc63c09
perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents:
16689
diff
changeset
|
229 # 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
|
230 if util.safehasattr(cl, 'clearcaches'): |
1dc08dc63c09
perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents:
16689
diff
changeset
|
231 cl.clearcaches() |
1dc08dc63c09
perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents:
16689
diff
changeset
|
232 elif util.safehasattr(cl, '_nodecache'): |
1dc08dc63c09
perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents:
16689
diff
changeset
|
233 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
|
234 cl._nodecache = {nullid: nullrev} |
1dc08dc63c09
perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents:
16689
diff
changeset
|
235 cl._nodepos = None |
1dc08dc63c09
perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents:
16689
diff
changeset
|
236 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
237 @command('perfheads', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
238 def perfheads(ui, repo, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
239 timer, fm = gettimer(ui, opts) |
16785
1dc08dc63c09
perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents:
16689
diff
changeset
|
240 cl = repo.changelog |
1dc08dc63c09
perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents:
16689
diff
changeset
|
241 def d(): |
1dc08dc63c09
perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents:
16689
diff
changeset
|
242 len(cl.headrevs()) |
1dc08dc63c09
perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents:
16689
diff
changeset
|
243 clearcaches(cl) |
1dc08dc63c09
perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents:
16689
diff
changeset
|
244 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
245 fm.end() |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
246 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
247 @command('perftags', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
248 def perftags(ui, repo, **opts): |
19786
fe8795dee77d
perf: rearrange imports of changelong and manifest to appease check-code
Augie Fackler <raf@durin42.com>
parents:
19712
diff
changeset
|
249 import mercurial.changelog |
fe8795dee77d
perf: rearrange imports of changelong and manifest to appease check-code
Augie Fackler <raf@durin42.com>
parents:
19712
diff
changeset
|
250 import mercurial.manifest |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
251 timer, fm = gettimer(ui, opts) |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
252 def t(): |
23878
37a92908a382
localrepo: remove all external users of localrepo.sopener
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
23788
diff
changeset
|
253 repo.changelog = mercurial.changelog.changelog(repo.svfs) |
37a92908a382
localrepo: remove all external users of localrepo.sopener
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
23788
diff
changeset
|
254 repo.manifest = mercurial.manifest.manifest(repo.svfs) |
9146
5614a628d173
localrepo: rename in-memory tag cache instance attributes (issue548).
Greg Ward <greg-hg@gerg.ca>
parents:
8873
diff
changeset
|
255 repo._tags = None |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
256 return len(repo.tags()) |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
257 timer(t) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
258 fm.end() |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
259 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
260 @command('perfancestors', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
261 def perfancestors(ui, repo, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
262 timer, fm = gettimer(ui, opts) |
16802
7e5d94381cd1
perf: add a perfancestors benchmark
Bryan O'Sullivan <bryano@fb.com>
parents:
16788
diff
changeset
|
263 heads = repo.changelog.headrevs() |
7e5d94381cd1
perf: add a perfancestors benchmark
Bryan O'Sullivan <bryano@fb.com>
parents:
16788
diff
changeset
|
264 def d(): |
16866
91f3ac205816
revlog: ancestors(*revs) becomes ancestors(revs) (API)
Bryan O'Sullivan <bryano@fb.com>
parents:
16858
diff
changeset
|
265 for a in repo.changelog.ancestors(heads): |
16802
7e5d94381cd1
perf: add a perfancestors benchmark
Bryan O'Sullivan <bryano@fb.com>
parents:
16788
diff
changeset
|
266 pass |
7e5d94381cd1
perf: add a perfancestors benchmark
Bryan O'Sullivan <bryano@fb.com>
parents:
16788
diff
changeset
|
267 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
268 fm.end() |
16802
7e5d94381cd1
perf: add a perfancestors benchmark
Bryan O'Sullivan <bryano@fb.com>
parents:
16788
diff
changeset
|
269 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
270 @command('perfancestorset', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
271 def perfancestorset(ui, repo, revset, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
272 timer, fm = gettimer(ui, opts) |
18080
486bfb200b3f
perf: add command to test performance of membership in ancestor set
Siddharth Agarwal <sid0@fb.com>
parents:
18062
diff
changeset
|
273 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
|
274 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
|
275 def d(): |
18091
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18080
diff
changeset
|
276 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
|
277 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
|
278 rev in s |
486bfb200b3f
perf: add command to test performance of membership in ancestor set
Siddharth Agarwal <sid0@fb.com>
parents:
18062
diff
changeset
|
279 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
280 fm.end() |
18080
486bfb200b3f
perf: add command to test performance of membership in ancestor set
Siddharth Agarwal <sid0@fb.com>
parents:
18062
diff
changeset
|
281 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
282 @command('perfdirs', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
283 def perfdirs(ui, repo, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
284 timer, fm = gettimer(ui, opts) |
18845
c1f416e4bc80
perf: add perfdirs command
Bryan O'Sullivan <bryano@fb.com>
parents:
18837
diff
changeset
|
285 dirstate = repo.dirstate |
c1f416e4bc80
perf: add perfdirs command
Bryan O'Sullivan <bryano@fb.com>
parents:
18837
diff
changeset
|
286 'a' in dirstate |
c1f416e4bc80
perf: add perfdirs command
Bryan O'Sullivan <bryano@fb.com>
parents:
18837
diff
changeset
|
287 def d(): |
c1f416e4bc80
perf: add perfdirs command
Bryan O'Sullivan <bryano@fb.com>
parents:
18837
diff
changeset
|
288 dirstate.dirs() |
c1f416e4bc80
perf: add perfdirs command
Bryan O'Sullivan <bryano@fb.com>
parents:
18837
diff
changeset
|
289 del dirstate._dirs |
c1f416e4bc80
perf: add perfdirs command
Bryan O'Sullivan <bryano@fb.com>
parents:
18837
diff
changeset
|
290 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
291 fm.end() |
18845
c1f416e4bc80
perf: add perfdirs command
Bryan O'Sullivan <bryano@fb.com>
parents:
18837
diff
changeset
|
292 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
293 @command('perfdirstate', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
294 def perfdirstate(ui, repo, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
295 timer, fm = gettimer(ui, opts) |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
296 "a" in repo.dirstate |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
297 def d(): |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
298 repo.dirstate.invalidate() |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
299 "a" in repo.dirstate |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
300 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
301 fm.end() |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
302 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
303 @command('perfdirstatedirs', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
304 def perfdirstatedirs(ui, repo, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
305 timer, fm = gettimer(ui, opts) |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
306 "a" in repo.dirstate |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
307 def d(): |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
308 "a" in repo.dirstate._dirs |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
309 del repo.dirstate._dirs |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
310 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
311 fm.end() |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
312 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
313 @command('perfdirstatefoldmap', formatteropts) |
27095
aaf4e2d77148
contrib/perf: name functions to match decorators
timeless <timeless@mozdev.org>
parents:
27072
diff
changeset
|
314 def perfdirstatefoldmap(ui, repo, **opts): |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
315 timer, fm = gettimer(ui, opts) |
22780
d8ff1f671aed
perf: add a way to measure the perf of constructing the foldmap
Siddharth Agarwal <sid0@fb.com>
parents:
20846
diff
changeset
|
316 dirstate = repo.dirstate |
d8ff1f671aed
perf: add a way to measure the perf of constructing the foldmap
Siddharth Agarwal <sid0@fb.com>
parents:
20846
diff
changeset
|
317 'a' in dirstate |
d8ff1f671aed
perf: add a way to measure the perf of constructing the foldmap
Siddharth Agarwal <sid0@fb.com>
parents:
20846
diff
changeset
|
318 def d(): |
24607
f5b527024fcc
perf: make measuring foldmap perf work again
Siddharth Agarwal <sid0@fb.com>
parents:
24349
diff
changeset
|
319 dirstate._filefoldmap.get('a') |
f5b527024fcc
perf: make measuring foldmap perf work again
Siddharth Agarwal <sid0@fb.com>
parents:
24349
diff
changeset
|
320 del dirstate._filefoldmap |
f5b527024fcc
perf: make measuring foldmap perf work again
Siddharth Agarwal <sid0@fb.com>
parents:
24349
diff
changeset
|
321 timer(d) |
f5b527024fcc
perf: make measuring foldmap perf work again
Siddharth Agarwal <sid0@fb.com>
parents:
24349
diff
changeset
|
322 fm.end() |
f5b527024fcc
perf: make measuring foldmap perf work again
Siddharth Agarwal <sid0@fb.com>
parents:
24349
diff
changeset
|
323 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
324 @command('perfdirfoldmap', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
325 def perfdirfoldmap(ui, repo, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
326 timer, fm = gettimer(ui, opts) |
24607
f5b527024fcc
perf: make measuring foldmap perf work again
Siddharth Agarwal <sid0@fb.com>
parents:
24349
diff
changeset
|
327 dirstate = repo.dirstate |
f5b527024fcc
perf: make measuring foldmap perf work again
Siddharth Agarwal <sid0@fb.com>
parents:
24349
diff
changeset
|
328 'a' in dirstate |
f5b527024fcc
perf: make measuring foldmap perf work again
Siddharth Agarwal <sid0@fb.com>
parents:
24349
diff
changeset
|
329 def d(): |
f5b527024fcc
perf: make measuring foldmap perf work again
Siddharth Agarwal <sid0@fb.com>
parents:
24349
diff
changeset
|
330 dirstate._dirfoldmap.get('a') |
f5b527024fcc
perf: make measuring foldmap perf work again
Siddharth Agarwal <sid0@fb.com>
parents:
24349
diff
changeset
|
331 del dirstate._dirfoldmap |
22780
d8ff1f671aed
perf: add a way to measure the perf of constructing the foldmap
Siddharth Agarwal <sid0@fb.com>
parents:
20846
diff
changeset
|
332 del dirstate._dirs |
d8ff1f671aed
perf: add a way to measure the perf of constructing the foldmap
Siddharth Agarwal <sid0@fb.com>
parents:
20846
diff
changeset
|
333 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
334 fm.end() |
22780
d8ff1f671aed
perf: add a way to measure the perf of constructing the foldmap
Siddharth Agarwal <sid0@fb.com>
parents:
20846
diff
changeset
|
335 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
336 @command('perfdirstatewrite', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
337 def perfdirstatewrite(ui, repo, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
338 timer, fm = gettimer(ui, opts) |
16788
7e72c1609862
perf: add a perfdirstatewrite benchmark
Bryan O'Sullivan <bryano@fb.com>
parents:
16785
diff
changeset
|
339 ds = repo.dirstate |
7e72c1609862
perf: add a perfdirstatewrite benchmark
Bryan O'Sullivan <bryano@fb.com>
parents:
16785
diff
changeset
|
340 "a" in ds |
7e72c1609862
perf: add a perfdirstatewrite benchmark
Bryan O'Sullivan <bryano@fb.com>
parents:
16785
diff
changeset
|
341 def d(): |
7e72c1609862
perf: add a perfdirstatewrite benchmark
Bryan O'Sullivan <bryano@fb.com>
parents:
16785
diff
changeset
|
342 ds._dirty = True |
26748
5ba0a99ff27f
dirstate: make dirstate.write() callers pass transaction object to it
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
25850
diff
changeset
|
343 ds.write(repo.currenttransaction()) |
16788
7e72c1609862
perf: add a perfdirstatewrite benchmark
Bryan O'Sullivan <bryano@fb.com>
parents:
16785
diff
changeset
|
344 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
345 fm.end() |
16788
7e72c1609862
perf: add a perfdirstatewrite benchmark
Bryan O'Sullivan <bryano@fb.com>
parents:
16785
diff
changeset
|
346 |
18817
c760acc6f69d
perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents:
18644
diff
changeset
|
347 @command('perfmergecalculate', |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
348 [('r', 'rev', '.', 'rev to merge against')] + formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
349 def perfmergecalculate(ui, repo, rev, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
350 timer, fm = gettimer(ui, opts) |
18817
c760acc6f69d
perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents:
18644
diff
changeset
|
351 wctx = repo[None] |
c760acc6f69d
perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents:
18644
diff
changeset
|
352 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
|
353 ancestor = wctx.ancestor(rctx) |
c760acc6f69d
perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents:
18644
diff
changeset
|
354 # 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
|
355 # that cache |
c760acc6f69d
perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents:
18644
diff
changeset
|
356 wctx.dirty() |
c760acc6f69d
perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents:
18644
diff
changeset
|
357 def d(): |
c760acc6f69d
perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents:
18644
diff
changeset
|
358 # 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
|
359 # our benchmark |
27098
64cb281d23a5
contrib/perf: fix perfmergecalculate
timeless <timeless@mozdev.org>
parents:
27097
diff
changeset
|
360 merge.calculateupdates(repo, wctx, rctx, [ancestor], False, False, |
27345
98266b1d144d
merge: restate calculateupdates in terms of a matcher
Augie Fackler <augie@google.com>
parents:
27308
diff
changeset
|
361 acceptremote=True, followcopies=True) |
18817
c760acc6f69d
perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents:
18644
diff
changeset
|
362 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
363 fm.end() |
18817
c760acc6f69d
perf: add a command to measure merge.calculateupdates perf
Siddharth Agarwal <sid0@fb.com>
parents:
18644
diff
changeset
|
364 |
18877
2e9fe9e2671f
perf: add a command to test copies.pathcopies perf
Siddharth Agarwal <sid0@fb.com>
parents:
18871
diff
changeset
|
365 @command('perfpathcopies', [], "REV REV") |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
366 def perfpathcopies(ui, repo, rev1, rev2, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
367 timer, fm = gettimer(ui, opts) |
18877
2e9fe9e2671f
perf: add a command to test copies.pathcopies perf
Siddharth Agarwal <sid0@fb.com>
parents:
18871
diff
changeset
|
368 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
|
369 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
|
370 def d(): |
2e9fe9e2671f
perf: add a command to test copies.pathcopies perf
Siddharth Agarwal <sid0@fb.com>
parents:
18871
diff
changeset
|
371 copies.pathcopies(ctx1, ctx2) |
2e9fe9e2671f
perf: add a command to test copies.pathcopies perf
Siddharth Agarwal <sid0@fb.com>
parents:
18871
diff
changeset
|
372 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
373 fm.end() |
18877
2e9fe9e2671f
perf: add a command to test copies.pathcopies perf
Siddharth Agarwal <sid0@fb.com>
parents:
18871
diff
changeset
|
374 |
19712
79e5de2bfa8c
perfmanifest: allow and require passing in a rev
Siddharth Agarwal <sid0@fb.com>
parents:
19711
diff
changeset
|
375 @command('perfmanifest', [], 'REV') |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
376 def perfmanifest(ui, repo, rev, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
377 timer, fm = gettimer(ui, opts) |
19712
79e5de2bfa8c
perfmanifest: allow and require passing in a rev
Siddharth Agarwal <sid0@fb.com>
parents:
19711
diff
changeset
|
378 ctx = scmutil.revsingle(repo, rev, rev) |
79e5de2bfa8c
perfmanifest: allow and require passing in a rev
Siddharth Agarwal <sid0@fb.com>
parents:
19711
diff
changeset
|
379 t = ctx.manifestnode() |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
380 def d(): |
27467
fbe292b591ec
perf: call clearcaches() in perfmanifest
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27382
diff
changeset
|
381 repo.manifest.clearcaches() |
19378
9de689d20230
cleanup: drop unused variables and an unused import
Simon Heimberg <simohe@besonet.ch>
parents:
19322
diff
changeset
|
382 repo.manifest.read(t) |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
383 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
384 fm.end() |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
385 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
386 @command('perfchangeset', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
387 def perfchangeset(ui, repo, rev, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
388 timer, fm = gettimer(ui, opts) |
16262
bf7a6c3b2a4a
perf: add perfchangeset to time changeset parsing
Matt Mackall <mpm@selenic.com>
parents:
16260
diff
changeset
|
389 n = repo[rev].node() |
bf7a6c3b2a4a
perf: add perfchangeset to time changeset parsing
Matt Mackall <mpm@selenic.com>
parents:
16260
diff
changeset
|
390 def d(): |
19378
9de689d20230
cleanup: drop unused variables and an unused import
Simon Heimberg <simohe@besonet.ch>
parents:
19322
diff
changeset
|
391 repo.changelog.read(n) |
16266
77d56a5e74a5
perf: add a changeset test
Matt Mackall <mpm@selenic.com>
parents:
16262
diff
changeset
|
392 #repo.changelog._cache = None |
16262
bf7a6c3b2a4a
perf: add perfchangeset to time changeset parsing
Matt Mackall <mpm@selenic.com>
parents:
16260
diff
changeset
|
393 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
394 fm.end() |
16262
bf7a6c3b2a4a
perf: add perfchangeset to time changeset parsing
Matt Mackall <mpm@selenic.com>
parents:
16260
diff
changeset
|
395 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
396 @command('perfindex', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
397 def perfindex(ui, repo, **opts): |
13255
2696730ca233
perf: make perfindex results useful on hg with lazyparser
Matt Mackall <mpm@selenic.com>
parents:
13254
diff
changeset
|
398 import mercurial.revlog |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
399 timer, fm = gettimer(ui, opts) |
13277
9f707b297b0f
perf: restore lazyindex hack
Matt Mackall <mpm@selenic.com>
parents:
13262
diff
changeset
|
400 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
|
401 n = repo["tip"].node() |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
402 def d(): |
23878
37a92908a382
localrepo: remove all external users of localrepo.sopener
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
23788
diff
changeset
|
403 cl = mercurial.revlog.revlog(repo.svfs, "00changelog.i") |
16260
33fcad3cfbbc
perf: tweak tests for testing index performance improvements
Matt Mackall <mpm@selenic.com>
parents:
14671
diff
changeset
|
404 cl.rev(n) |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
405 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
406 fm.end() |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
407 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
408 @command('perfstartup', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
409 def perfstartup(ui, repo, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
410 timer, fm = gettimer(ui, opts) |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
411 cmd = sys.argv[0] |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
412 def d(): |
27382
de7bcbc68042
perf: adjust perfstartup() for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
27345
diff
changeset
|
413 if os.name != 'nt': |
de7bcbc68042
perf: adjust perfstartup() for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
27345
diff
changeset
|
414 os.system("HGRCPATH= %s version -q > /dev/null" % cmd) |
de7bcbc68042
perf: adjust perfstartup() for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
27345
diff
changeset
|
415 else: |
de7bcbc68042
perf: adjust perfstartup() for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
27345
diff
changeset
|
416 os.environ['HGRCPATH'] = '' |
de7bcbc68042
perf: adjust perfstartup() for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
27345
diff
changeset
|
417 os.system("%s version -q > NUL" % cmd) |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
418 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
419 fm.end() |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
420 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
421 @command('perfparents', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
422 def perfparents(ui, repo, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
423 timer, fm = gettimer(ui, opts) |
27305
5831cfbf0e33
perf: perfparents honor config perf.parentscount
timeless <timeless@mozdev.org>
parents:
27304
diff
changeset
|
424 # control the number of commits perfparents iterates over |
5831cfbf0e33
perf: perfparents honor config perf.parentscount
timeless <timeless@mozdev.org>
parents:
27304
diff
changeset
|
425 # experimental config: perf.parentscount |
5831cfbf0e33
perf: perfparents honor config perf.parentscount
timeless <timeless@mozdev.org>
parents:
27304
diff
changeset
|
426 count = ui.configint("perf", "parentscount", 1000) |
5831cfbf0e33
perf: perfparents honor config perf.parentscount
timeless <timeless@mozdev.org>
parents:
27304
diff
changeset
|
427 if len(repo.changelog) < count: |
5831cfbf0e33
perf: perfparents honor config perf.parentscount
timeless <timeless@mozdev.org>
parents:
27304
diff
changeset
|
428 raise error.Abort("repo needs %d commits for this test" % count) |
27100
8d5dba93aa4f
contrib/perf: perfparents handle filtered repos
timeless <timeless@mozdev.org>
parents:
27099
diff
changeset
|
429 repo = repo.unfiltered() |
27305
5831cfbf0e33
perf: perfparents honor config perf.parentscount
timeless <timeless@mozdev.org>
parents:
27304
diff
changeset
|
430 nl = [repo.changelog.node(i) for i in xrange(count)] |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
431 def d(): |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
432 for n in nl: |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
433 repo.changelog.parents(n) |
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
434 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
435 fm.end() |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
436 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
437 @command('perfctxfiles', formatteropts) |
27095
aaf4e2d77148
contrib/perf: name functions to match decorators
timeless <timeless@mozdev.org>
parents:
27072
diff
changeset
|
438 def perfctxfiles(ui, repo, x, **opts): |
24349
389693a245fa
perf: add methods for timing changeset file list reading
Matt Mackall <mpm@selenic.com>
parents:
23878
diff
changeset
|
439 x = int(x) |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
440 timer, fm = gettimer(ui, opts) |
24349
389693a245fa
perf: add methods for timing changeset file list reading
Matt Mackall <mpm@selenic.com>
parents:
23878
diff
changeset
|
441 def d(): |
389693a245fa
perf: add methods for timing changeset file list reading
Matt Mackall <mpm@selenic.com>
parents:
23878
diff
changeset
|
442 len(repo[x].files()) |
389693a245fa
perf: add methods for timing changeset file list reading
Matt Mackall <mpm@selenic.com>
parents:
23878
diff
changeset
|
443 timer(d) |
389693a245fa
perf: add methods for timing changeset file list reading
Matt Mackall <mpm@selenic.com>
parents:
23878
diff
changeset
|
444 fm.end() |
389693a245fa
perf: add methods for timing changeset file list reading
Matt Mackall <mpm@selenic.com>
parents:
23878
diff
changeset
|
445 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
446 @command('perfrawfiles', formatteropts) |
27095
aaf4e2d77148
contrib/perf: name functions to match decorators
timeless <timeless@mozdev.org>
parents:
27072
diff
changeset
|
447 def perfrawfiles(ui, repo, x, **opts): |
24349
389693a245fa
perf: add methods for timing changeset file list reading
Matt Mackall <mpm@selenic.com>
parents:
23878
diff
changeset
|
448 x = int(x) |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
449 timer, fm = gettimer(ui, opts) |
24349
389693a245fa
perf: add methods for timing changeset file list reading
Matt Mackall <mpm@selenic.com>
parents:
23878
diff
changeset
|
450 cl = repo.changelog |
389693a245fa
perf: add methods for timing changeset file list reading
Matt Mackall <mpm@selenic.com>
parents:
23878
diff
changeset
|
451 def d(): |
389693a245fa
perf: add methods for timing changeset file list reading
Matt Mackall <mpm@selenic.com>
parents:
23878
diff
changeset
|
452 len(cl.read(x)[3]) |
389693a245fa
perf: add methods for timing changeset file list reading
Matt Mackall <mpm@selenic.com>
parents:
23878
diff
changeset
|
453 timer(d) |
389693a245fa
perf: add methods for timing changeset file list reading
Matt Mackall <mpm@selenic.com>
parents:
23878
diff
changeset
|
454 fm.end() |
389693a245fa
perf: add methods for timing changeset file list reading
Matt Mackall <mpm@selenic.com>
parents:
23878
diff
changeset
|
455 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
456 @command('perflookup', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
457 def perflookup(ui, repo, rev, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
458 timer, fm = gettimer(ui, opts) |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
459 timer(lambda: len(repo.lookup(rev))) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
460 fm.end() |
7366
eb240755386d
Add contrib/perf.py for performance testing
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
461 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
462 @command('perfrevrange', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
463 def perfrevrange(ui, repo, *specs, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
464 timer, fm = gettimer(ui, opts) |
16858
fdf99e0f60f3
perf: add a benchmark for revrange
Bryan O'Sullivan <bryano@fb.com>
parents:
16802
diff
changeset
|
465 revrange = scmutil.revrange |
fdf99e0f60f3
perf: add a benchmark for revrange
Bryan O'Sullivan <bryano@fb.com>
parents:
16802
diff
changeset
|
466 timer(lambda: len(revrange(repo, specs))) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
467 fm.end() |
16858
fdf99e0f60f3
perf: add a benchmark for revrange
Bryan O'Sullivan <bryano@fb.com>
parents:
16802
diff
changeset
|
468 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
469 @command('perfnodelookup', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
470 def perfnodelookup(ui, repo, rev, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
471 timer, fm = gettimer(ui, opts) |
16309 | 472 import mercurial.revlog |
473 mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg | |
474 n = repo[rev].node() | |
23878
37a92908a382
localrepo: remove all external users of localrepo.sopener
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
23788
diff
changeset
|
475 cl = mercurial.revlog.revlog(repo.svfs, "00changelog.i") |
16414
e8d37b78acfb
parsers: use base-16 trie for faster node->rev mapping
Bryan O'Sullivan <bryano@fb.com>
parents:
16403
diff
changeset
|
476 def d(): |
e8d37b78acfb
parsers: use base-16 trie for faster node->rev mapping
Bryan O'Sullivan <bryano@fb.com>
parents:
16403
diff
changeset
|
477 cl.rev(n) |
16785
1dc08dc63c09
perf: rework perfheads and perftags to clear caches
Bryan O'Sullivan <bryano@fb.com>
parents:
16689
diff
changeset
|
478 clearcaches(cl) |
16414
e8d37b78acfb
parsers: use base-16 trie for faster node->rev mapping
Bryan O'Sullivan <bryano@fb.com>
parents:
16403
diff
changeset
|
479 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
480 fm.end() |
16414
e8d37b78acfb
parsers: use base-16 trie for faster node->rev mapping
Bryan O'Sullivan <bryano@fb.com>
parents:
16403
diff
changeset
|
481 |
18237
4132dc9bd5c4
perftest: migrate to new style command declaration
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
18236
diff
changeset
|
482 @command('perflog', |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
483 [('', 'rename', False, 'ask log to follow renames')] + formatteropts) |
27306
bafb1235f505
perf: add optional rev for perflog and perftemplating
timeless <timeless@mozdev.org>
parents:
27305
diff
changeset
|
484 def perflog(ui, repo, rev=None, **opts): |
bafb1235f505
perf: add optional rev for perflog and perftemplating
timeless <timeless@mozdev.org>
parents:
27305
diff
changeset
|
485 if rev is None: |
bafb1235f505
perf: add optional rev for perflog and perftemplating
timeless <timeless@mozdev.org>
parents:
27305
diff
changeset
|
486 rev=[] |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
487 timer, fm = gettimer(ui, opts) |
7872
f680a1bd679b
contrib: add perflog and perftemplating commands to perf extension
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7366
diff
changeset
|
488 ui.pushbuffer() |
27306
bafb1235f505
perf: add optional rev for perflog and perftemplating
timeless <timeless@mozdev.org>
parents:
27305
diff
changeset
|
489 timer(lambda: commands.log(ui, repo, rev=rev, date='', user='', |
9932
2fcbef9a349a
perf.perflog: add option to follow renames
Alexander Solovyov <piranha@piranha.org.ua>
parents:
9826
diff
changeset
|
490 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
|
491 ui.popbuffer() |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
492 fm.end() |
7872
f680a1bd679b
contrib: add perflog and perftemplating commands to perf extension
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7366
diff
changeset
|
493 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
494 @command('perfmoonwalk', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
495 def perfmoonwalk(ui, repo, **opts): |
20178
74aea4be8e78
perf: add perfmoonwalk command to walk the changelog backwards
Brodie Rao <brodie@sf.io>
parents:
20032
diff
changeset
|
496 """benchmark walking the changelog backwards |
74aea4be8e78
perf: add perfmoonwalk command to walk the changelog backwards
Brodie Rao <brodie@sf.io>
parents:
20032
diff
changeset
|
497 |
74aea4be8e78
perf: add perfmoonwalk command to walk the changelog backwards
Brodie Rao <brodie@sf.io>
parents:
20032
diff
changeset
|
498 This also loads the changelog data for each revision in the changelog. |
74aea4be8e78
perf: add perfmoonwalk command to walk the changelog backwards
Brodie Rao <brodie@sf.io>
parents:
20032
diff
changeset
|
499 """ |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
500 timer, fm = gettimer(ui, opts) |
20178
74aea4be8e78
perf: add perfmoonwalk command to walk the changelog backwards
Brodie Rao <brodie@sf.io>
parents:
20032
diff
changeset
|
501 def moonwalk(): |
74aea4be8e78
perf: add perfmoonwalk command to walk the changelog backwards
Brodie Rao <brodie@sf.io>
parents:
20032
diff
changeset
|
502 for i in xrange(len(repo), -1, -1): |
74aea4be8e78
perf: add perfmoonwalk command to walk the changelog backwards
Brodie Rao <brodie@sf.io>
parents:
20032
diff
changeset
|
503 ctx = repo[i] |
74aea4be8e78
perf: add perfmoonwalk command to walk the changelog backwards
Brodie Rao <brodie@sf.io>
parents:
20032
diff
changeset
|
504 ctx.branch() # read changelog data (in addition to the index) |
74aea4be8e78
perf: add perfmoonwalk command to walk the changelog backwards
Brodie Rao <brodie@sf.io>
parents:
20032
diff
changeset
|
505 timer(moonwalk) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
506 fm.end() |
20178
74aea4be8e78
perf: add perfmoonwalk command to walk the changelog backwards
Brodie Rao <brodie@sf.io>
parents:
20032
diff
changeset
|
507 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
508 @command('perftemplating', formatteropts) |
27306
bafb1235f505
perf: add optional rev for perflog and perftemplating
timeless <timeless@mozdev.org>
parents:
27305
diff
changeset
|
509 def perftemplating(ui, repo, rev=None, **opts): |
bafb1235f505
perf: add optional rev for perflog and perftemplating
timeless <timeless@mozdev.org>
parents:
27305
diff
changeset
|
510 if rev is None: |
bafb1235f505
perf: add optional rev for perflog and perftemplating
timeless <timeless@mozdev.org>
parents:
27305
diff
changeset
|
511 rev=[] |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
512 timer, fm = gettimer(ui, opts) |
7872
f680a1bd679b
contrib: add perflog and perftemplating commands to perf extension
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7366
diff
changeset
|
513 ui.pushbuffer() |
27306
bafb1235f505
perf: add optional rev for perflog and perftemplating
timeless <timeless@mozdev.org>
parents:
27305
diff
changeset
|
514 timer(lambda: commands.log(ui, repo, rev=rev, date='', user='', |
7872
f680a1bd679b
contrib: add perflog and perftemplating commands to perf extension
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7366
diff
changeset
|
515 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
|
516 ' {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
|
517 ui.popbuffer() |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
518 fm.end() |
7872
f680a1bd679b
contrib: add perflog and perftemplating commands to perf extension
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7366
diff
changeset
|
519 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
520 @command('perfcca', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
521 def perfcca(ui, repo, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
522 timer, fm = gettimer(ui, opts) |
17216
01c1ee4bd1dd
perf: fix perfcca to work with new casecollisionauditor interface
Joshua Redstone <joshua.redstone@fb.com>
parents:
16866
diff
changeset
|
523 timer(lambda: scmutil.casecollisionauditor(ui, False, repo.dirstate)) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
524 fm.end() |
16386
ccc173d0914e
perf: add case collision auditor perf
Matt Mackall <mpm@selenic.com>
parents:
16309
diff
changeset
|
525 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
526 @command('perffncacheload', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
527 def perffncacheload(ui, repo, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
528 timer, fm = gettimer(ui, opts) |
17780
769f66861eb8
perf: simply use repo.store for perffncache* commands
Adrian Buehlmann <adrian@cadifra.com>
parents:
17553
diff
changeset
|
529 s = repo.store |
16403
efae1fea4bbd
perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents:
16386
diff
changeset
|
530 def d(): |
efae1fea4bbd
perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents:
16386
diff
changeset
|
531 s.fncache._load() |
efae1fea4bbd
perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents:
16386
diff
changeset
|
532 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
533 fm.end() |
16403
efae1fea4bbd
perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents:
16386
diff
changeset
|
534 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
535 @command('perffncachewrite', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
536 def perffncachewrite(ui, repo, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
537 timer, fm = gettimer(ui, opts) |
17780
769f66861eb8
perf: simply use repo.store for perffncache* commands
Adrian Buehlmann <adrian@cadifra.com>
parents:
17553
diff
changeset
|
538 s = repo.store |
16403
efae1fea4bbd
perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents:
16386
diff
changeset
|
539 s.fncache._load() |
27097
b3e24a9c5f9b
contrib/perf: fix perffncachewrite
timeless <timeless@mozdev.org>
parents:
27096
diff
changeset
|
540 lock = repo.lock() |
b3e24a9c5f9b
contrib/perf: fix perffncachewrite
timeless <timeless@mozdev.org>
parents:
27096
diff
changeset
|
541 tr = repo.transaction('perffncachewrite') |
16403
efae1fea4bbd
perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents:
16386
diff
changeset
|
542 def d(): |
efae1fea4bbd
perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents:
16386
diff
changeset
|
543 s.fncache._dirty = True |
27097
b3e24a9c5f9b
contrib/perf: fix perffncachewrite
timeless <timeless@mozdev.org>
parents:
27096
diff
changeset
|
544 s.fncache.write(tr) |
16403
efae1fea4bbd
perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents:
16386
diff
changeset
|
545 timer(d) |
27097
b3e24a9c5f9b
contrib/perf: fix perffncachewrite
timeless <timeless@mozdev.org>
parents:
27096
diff
changeset
|
546 lock.release() |
27526
11f2e496bdc9
perf: close transaction in perffncachewrite
Bryan O'Sullivan <bos@serpentine.com>
parents:
27493
diff
changeset
|
547 tr.close() |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
548 fm.end() |
16403
efae1fea4bbd
perf: time fncache read and write performance
Bryan O'Sullivan <bryano@fb.com>
parents:
16386
diff
changeset
|
549 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
550 @command('perffncacheencode', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
551 def perffncacheencode(ui, repo, **opts): |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
552 timer, fm = gettimer(ui, opts) |
17780
769f66861eb8
perf: simply use repo.store for perffncache* commands
Adrian Buehlmann <adrian@cadifra.com>
parents:
17553
diff
changeset
|
553 s = repo.store |
17553
5ab863922e0f
perf: add perffncacheencode
Adrian Buehlmann <adrian@cadifra.com>
parents:
17216
diff
changeset
|
554 s.fncache._load() |
5ab863922e0f
perf: add perffncacheencode
Adrian Buehlmann <adrian@cadifra.com>
parents:
17216
diff
changeset
|
555 def d(): |
5ab863922e0f
perf: add perffncacheencode
Adrian Buehlmann <adrian@cadifra.com>
parents:
17216
diff
changeset
|
556 for p in s.fncache.entries: |
5ab863922e0f
perf: add perffncacheencode
Adrian Buehlmann <adrian@cadifra.com>
parents:
17216
diff
changeset
|
557 s.encode(p) |
5ab863922e0f
perf: add perffncacheencode
Adrian Buehlmann <adrian@cadifra.com>
parents:
17216
diff
changeset
|
558 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
559 fm.end() |
17553
5ab863922e0f
perf: add perffncacheencode
Adrian Buehlmann <adrian@cadifra.com>
parents:
17216
diff
changeset
|
560 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
561 @command('perfdiffwd', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
562 def perfdiffwd(ui, repo, **opts): |
9826
d768614578dd
contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents:
9146
diff
changeset
|
563 """Profile diff of working directory changes""" |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
564 timer, fm = gettimer(ui, opts) |
9826
d768614578dd
contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents:
9146
diff
changeset
|
565 options = { |
d768614578dd
contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents:
9146
diff
changeset
|
566 'w': 'ignore_all_space', |
d768614578dd
contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents:
9146
diff
changeset
|
567 'b': 'ignore_space_change', |
d768614578dd
contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents:
9146
diff
changeset
|
568 'B': 'ignore_blank_lines', |
d768614578dd
contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents:
9146
diff
changeset
|
569 } |
d768614578dd
contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents:
9146
diff
changeset
|
570 |
d768614578dd
contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents:
9146
diff
changeset
|
571 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
|
572 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
|
573 def d(): |
d768614578dd
contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents:
9146
diff
changeset
|
574 ui.pushbuffer() |
d768614578dd
contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents:
9146
diff
changeset
|
575 commands.diff(ui, repo, **opts) |
d768614578dd
contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents:
9146
diff
changeset
|
576 ui.popbuffer() |
d768614578dd
contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents:
9146
diff
changeset
|
577 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
|
578 timer(d, title) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
579 fm.end() |
9826
d768614578dd
contrib/perf: profile diff of working directory changes
Patrick Mezard <pmezard@gmail.com>
parents:
9146
diff
changeset
|
580 |
27492
ac549d7fbc2b
perf: use standard arguments for perfrevlog
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27472
diff
changeset
|
581 @command('perfrevlog', revlogopts + formatteropts + |
27493
14b0930105da
perf: make start revision configurable for perfrevlog
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27492
diff
changeset
|
582 [('d', 'dist', 100, 'distance between the revisions'), |
14b0930105da
perf: make start revision configurable for perfrevlog
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27492
diff
changeset
|
583 ('s', 'startrev', 0, 'revision to start reading at')], |
27492
ac549d7fbc2b
perf: use standard arguments for perfrevlog
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27472
diff
changeset
|
584 '-c|-m|FILE') |
27493
14b0930105da
perf: make start revision configurable for perfrevlog
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27492
diff
changeset
|
585 def perfrevlog(ui, repo, file_=None, startrev=0, **opts): |
27492
ac549d7fbc2b
perf: use standard arguments for perfrevlog
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27472
diff
changeset
|
586 """Benchmark reading a series of revisions from a revlog. |
ac549d7fbc2b
perf: use standard arguments for perfrevlog
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27472
diff
changeset
|
587 |
ac549d7fbc2b
perf: use standard arguments for perfrevlog
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27472
diff
changeset
|
588 By default, we read every ``-d/--dist`` revision from 0 to tip of |
ac549d7fbc2b
perf: use standard arguments for perfrevlog
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27472
diff
changeset
|
589 the specified revlog. |
27493
14b0930105da
perf: make start revision configurable for perfrevlog
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27492
diff
changeset
|
590 |
14b0930105da
perf: make start revision configurable for perfrevlog
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27492
diff
changeset
|
591 The start revision can be defined via ``-s/--startrev``. |
27492
ac549d7fbc2b
perf: use standard arguments for perfrevlog
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27472
diff
changeset
|
592 """ |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
593 timer, fm = gettimer(ui, opts) |
11694
bf49d48e4602
perf: add perfrevlog function to check performance of revlog
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
10493
diff
changeset
|
594 dist = opts['dist'] |
27308
7bc52ac46172
perf: perfrevlog optimize for perf.stub
timeless <timeless@mozdev.org>
parents:
27307
diff
changeset
|
595 _len = getlen(ui) |
11694
bf49d48e4602
perf: add perfrevlog function to check performance of revlog
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
10493
diff
changeset
|
596 def d(): |
27492
ac549d7fbc2b
perf: use standard arguments for perfrevlog
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27472
diff
changeset
|
597 r = cmdutil.openrevlog(repo, 'perfrevlog', file_, opts) |
27493
14b0930105da
perf: make start revision configurable for perfrevlog
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27492
diff
changeset
|
598 for x in xrange(startrev, _len(r), dist): |
11694
bf49d48e4602
perf: add perfrevlog function to check performance of revlog
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
10493
diff
changeset
|
599 r.revision(r.node(x)) |
bf49d48e4602
perf: add perfrevlog function to check performance of revlog
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
10493
diff
changeset
|
600 |
bf49d48e4602
perf: add perfrevlog function to check performance of revlog
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
10493
diff
changeset
|
601 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
602 fm.end() |
11694
bf49d48e4602
perf: add perfrevlog function to check performance of revlog
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
10493
diff
changeset
|
603 |
27470
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
604 @command('perfrevlogrevision', revlogopts + formatteropts + |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
605 [('', 'cache', False, 'use caches instead of clearing')], |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
606 '-c|-m|FILE REV') |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
607 def perfrevlogrevision(ui, repo, file_, rev=None, cache=None, **opts): |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
608 """Benchmark obtaining a revlog revision. |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
609 |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
610 Obtaining a revlog revision consists of roughly the following steps: |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
611 |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
612 1. Compute the delta chain |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
613 2. Obtain the raw chunks for that delta chain |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
614 3. Decompress each raw chunk |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
615 4. Apply binary patches to obtain fulltext |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
616 5. Verify hash of fulltext |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
617 |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
618 This command measures the time spent in each of these phases. |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
619 """ |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
620 if opts.get('changelog') or opts.get('manifest'): |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
621 file_, rev = None, file_ |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
622 elif rev is None: |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
623 raise error.CommandError('perfrevlogrevision', 'invalid arguments') |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
624 |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
625 r = cmdutil.openrevlog(repo, 'perfrevlogrevision', file_, opts) |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
626 node = r.lookup(rev) |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
627 rev = r.rev(node) |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
628 |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
629 def dodeltachain(rev): |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
630 if not cache: |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
631 r.clearcaches() |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
632 r._deltachain(rev) |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
633 |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
634 def doread(chain): |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
635 if not cache: |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
636 r.clearcaches() |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
637 r._chunkraw(chain[0], chain[-1]) |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
638 |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
639 def dodecompress(data, chain): |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
640 if not cache: |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
641 r.clearcaches() |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
642 |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
643 start = r.start |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
644 length = r.length |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
645 inline = r._inline |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
646 iosize = r._io.size |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
647 buffer = util.buffer |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
648 offset = start(chain[0]) |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
649 |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
650 for rev in chain: |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
651 chunkstart = start(rev) |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
652 if inline: |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
653 chunkstart += (rev + 1) * iosize |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
654 chunklength = length(rev) |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
655 b = buffer(data, chunkstart - offset, chunklength) |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
656 revlog.decompress(b) |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
657 |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
658 def dopatch(text, bins): |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
659 if not cache: |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
660 r.clearcaches() |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
661 mdiff.patches(text, bins) |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
662 |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
663 def dohash(text): |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
664 if not cache: |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
665 r.clearcaches() |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
666 r._checkhash(text, node, rev) |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
667 |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
668 def dorevision(): |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
669 if not cache: |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
670 r.clearcaches() |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
671 r.revision(node) |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
672 |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
673 chain = r._deltachain(rev)[0] |
27649
6446e9b37c8b
revlog: return offset from _chunkraw()
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27526
diff
changeset
|
674 data = r._chunkraw(chain[0], chain[-1])[1] |
27470
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
675 bins = r._chunks(chain) |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
676 text = str(bins[0]) |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
677 bins = bins[1:] |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
678 text = mdiff.patches(text, bins) |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
679 |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
680 benches = [ |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
681 (lambda: dorevision(), 'full'), |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
682 (lambda: dodeltachain(rev), 'deltachain'), |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
683 (lambda: doread(chain), 'read'), |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
684 (lambda: dodecompress(data, chain), 'decompress'), |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
685 (lambda: dopatch(text, bins), 'patch'), |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
686 (lambda: dohash(text), 'hash'), |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
687 ] |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
688 |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
689 for fn, title in benches: |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
690 timer, fm = gettimer(ui, opts) |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
691 timer(fn, title=title) |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
692 fm.end() |
d394a1a3708a
perf: add perfrevlogrevision
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27467
diff
changeset
|
693 |
18239
a95f1d619bb7
perftest: add an option to invalidate volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18238
diff
changeset
|
694 @command('perfrevset', |
27072
e18a9ceade3b
perf: support obtaining contexts from perfrevset
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27017
diff
changeset
|
695 [('C', 'clear', False, 'clear volatile cache between each call.'), |
e18a9ceade3b
perf: support obtaining contexts from perfrevset
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27017
diff
changeset
|
696 ('', 'contexts', False, 'obtain changectx for each revision')] |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
697 + formatteropts, "REVSET") |
27072
e18a9ceade3b
perf: support obtaining contexts from perfrevset
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27017
diff
changeset
|
698 def perfrevset(ui, repo, expr, clear=False, contexts=False, **opts): |
18239
a95f1d619bb7
perftest: add an option to invalidate volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18238
diff
changeset
|
699 """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
|
700 |
18644
3e92772d5383
spelling: fix some minor issues found by spell checker
Mads Kiilerich <mads@kiilerich.com>
parents:
18304
diff
changeset
|
701 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
|
702 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
|
703 and obsolete related cache.""" |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
704 timer, fm = gettimer(ui, opts) |
18062
1471f5e83686
perf: add a command to measure revset performance
Siddharth Agarwal <sid0@fb.com>
parents:
18033
diff
changeset
|
705 def d(): |
18239
a95f1d619bb7
perftest: add an option to invalidate volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18238
diff
changeset
|
706 if clear: |
a95f1d619bb7
perftest: add an option to invalidate volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18238
diff
changeset
|
707 repo.invalidatevolatilesets() |
27072
e18a9ceade3b
perf: support obtaining contexts from perfrevset
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27017
diff
changeset
|
708 if contexts: |
e18a9ceade3b
perf: support obtaining contexts from perfrevset
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27017
diff
changeset
|
709 for ctx in repo.set(expr): pass |
e18a9ceade3b
perf: support obtaining contexts from perfrevset
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27017
diff
changeset
|
710 else: |
e18a9ceade3b
perf: support obtaining contexts from perfrevset
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27017
diff
changeset
|
711 for r in repo.revs(expr): pass |
18062
1471f5e83686
perf: add a command to measure revset performance
Siddharth Agarwal <sid0@fb.com>
parents:
18033
diff
changeset
|
712 timer(d) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
713 fm.end() |
18240
a8318715d8bb
perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18239
diff
changeset
|
714 |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
715 @command('perfvolatilesets', formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
716 def perfvolatilesets(ui, repo, *names, **opts): |
18240
a8318715d8bb
perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18239
diff
changeset
|
717 """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
|
718 |
a8318715d8bb
perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18239
diff
changeset
|
719 Volatile set computes element related to filtering and obsolescence.""" |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
720 timer, fm = gettimer(ui, opts) |
18240
a8318715d8bb
perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18239
diff
changeset
|
721 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
|
722 |
a8318715d8bb
perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18239
diff
changeset
|
723 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
|
724 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
|
725 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
|
726 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
|
727 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
|
728 |
18241
f5ed27c51995
perftest: allow selection of volatile set to benchmark
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18240
diff
changeset
|
729 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
|
730 if names: |
f5ed27c51995
perftest: allow selection of volatile set to benchmark
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18240
diff
changeset
|
731 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
|
732 |
f5ed27c51995
perftest: allow selection of volatile set to benchmark
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18240
diff
changeset
|
733 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
|
734 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
|
735 |
a8318715d8bb
perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18239
diff
changeset
|
736 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
|
737 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
|
738 repo.invalidatevolatilesets() |
20205
d67a7758da6d
perf: fix perfvolatilesets
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
20178
diff
changeset
|
739 repoview.filterrevs(repo, name) |
18240
a8318715d8bb
perftest: add a command to benchmark construction of volatile cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18239
diff
changeset
|
740 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
|
741 |
18241
f5ed27c51995
perftest: allow selection of volatile set to benchmark
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18240
diff
changeset
|
742 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
|
743 if names: |
f5ed27c51995
perftest: allow selection of volatile set to benchmark
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18240
diff
changeset
|
744 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
|
745 |
f5ed27c51995
perftest: allow selection of volatile set to benchmark
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18240
diff
changeset
|
746 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
|
747 timer(getfiltered(name), title=name) |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
748 fm.end() |
18304
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
749 |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
750 @command('perfbranchmap', |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
751 [('f', 'full', False, |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
752 'Includes build time of subset'), |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
753 ] + formatteropts) |
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
754 def perfbranchmap(ui, repo, full=False, **opts): |
18304
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
755 """benchmark the update of a branchmap |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
756 |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
757 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
|
758 """ |
25494
e8eb3ecdaa0c
perf: support -T for every perf commands
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24607
diff
changeset
|
759 timer, fm = gettimer(ui, opts) |
18304
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
760 def getbranchmap(filtername): |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
761 """generate a benchmark function for the filtername""" |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
762 if filtername is None: |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
763 view = repo |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
764 else: |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
765 view = repo.filtered(filtername) |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
766 def d(): |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
767 if full: |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
768 view._branchcaches.clear() |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
769 else: |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
770 view._branchcaches.pop(filtername, None) |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
771 view.branchmap() |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
772 return d |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
773 # 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
|
774 possiblefilters = set(repoview.filtertable) |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
775 allfilters = [] |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
776 while possiblefilters: |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
777 for name in possiblefilters: |
20032
175c6fd8cacc
subsettable: move from repoview to branchmap, the only place it's used
Augie Fackler <raf@durin42.com>
parents:
19786
diff
changeset
|
778 subset = branchmap.subsettable.get(name) |
18304
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
779 if subset not in possiblefilters: |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
780 break |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
781 else: |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
782 assert False, 'subset cycle %s!' % possiblefilters |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
783 allfilters.append(name) |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
784 possiblefilters.remove(name) |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
785 |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
786 # warm the cache |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
787 if not full: |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
788 for name in allfilters: |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
789 repo.filtered(name).branchmap() |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
790 # add unfiltered |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
791 allfilters.append(None) |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
792 oldread = branchmap.read |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
793 oldwrite = branchmap.branchcache.write |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
794 try: |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
795 branchmap.read = lambda repo: None |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
796 branchmap.write = lambda repo: None |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
797 for name in allfilters: |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
798 timer(getbranchmap(name), title=str(name)) |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
799 finally: |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
800 branchmap.read = oldread |
9b6ae29d4801
perf: add perfbranchmap command
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18241
diff
changeset
|
801 branchmap.branchcache.write = oldwrite |
23171
8afae1d5d108
perf: use a formatter for output
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22780
diff
changeset
|
802 fm.end() |
23485
ccb93e9affc1
perf: add a perfloadmarkers command
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
23171
diff
changeset
|
803 |
ccb93e9affc1
perf: add a perfloadmarkers command
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
23171
diff
changeset
|
804 @command('perfloadmarkers') |
ccb93e9affc1
perf: add a perfloadmarkers command
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
23171
diff
changeset
|
805 def perfloadmarkers(ui, repo): |
ccb93e9affc1
perf: add a perfloadmarkers command
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
23171
diff
changeset
|
806 """benchmark the time to parse the on-disk markers for a repo |
ccb93e9affc1
perf: add a perfloadmarkers command
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
23171
diff
changeset
|
807 |
ccb93e9affc1
perf: add a perfloadmarkers command
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
23171
diff
changeset
|
808 Result is the number of markers in the repo.""" |
ccb93e9affc1
perf: add a perfloadmarkers command
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
23171
diff
changeset
|
809 timer, fm = gettimer(ui) |
23878
37a92908a382
localrepo: remove all external users of localrepo.sopener
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
23788
diff
changeset
|
810 timer(lambda: len(obsolete.obsstore(repo.svfs))) |
23485
ccb93e9affc1
perf: add a perfloadmarkers command
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
23171
diff
changeset
|
811 fm.end() |
27286
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
812 |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
813 @command('perflrucachedict', formatteropts + |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
814 [('', 'size', 4, 'size of cache'), |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
815 ('', 'gets', 10000, 'number of key lookups'), |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
816 ('', 'sets', 10000, 'number of key sets'), |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
817 ('', 'mixed', 10000, 'number of mixed mode operations'), |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
818 ('', 'mixedgetfreq', 50, 'frequency of get vs set ops in mixed mode')], |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
819 norepo=True) |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
820 def perflrucache(ui, size=4, gets=10000, sets=10000, mixed=10000, |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
821 mixedgetfreq=50, **opts): |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
822 def doinit(): |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
823 for i in xrange(10000): |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
824 util.lrucachedict(size) |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
825 |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
826 values = [] |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
827 for i in xrange(size): |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
828 values.append(random.randint(0, sys.maxint)) |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
829 |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
830 # Get mode fills the cache and tests raw lookup performance with no |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
831 # eviction. |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
832 getseq = [] |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
833 for i in xrange(gets): |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
834 getseq.append(random.choice(values)) |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
835 |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
836 def dogets(): |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
837 d = util.lrucachedict(size) |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
838 for v in values: |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
839 d[v] = v |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
840 for key in getseq: |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
841 value = d[key] |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
842 value # silence pyflakes warning |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
843 |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
844 # Set mode tests insertion speed with cache eviction. |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
845 setseq = [] |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
846 for i in xrange(sets): |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
847 setseq.append(random.randint(0, sys.maxint)) |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
848 |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
849 def dosets(): |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
850 d = util.lrucachedict(size) |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
851 for v in setseq: |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
852 d[v] = v |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
853 |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
854 # Mixed mode randomly performs gets and sets with eviction. |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
855 mixedops = [] |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
856 for i in xrange(mixed): |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
857 r = random.randint(0, 100) |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
858 if r < mixedgetfreq: |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
859 op = 0 |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
860 else: |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
861 op = 1 |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
862 |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
863 mixedops.append((op, random.randint(0, size * 2))) |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
864 |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
865 def domixed(): |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
866 d = util.lrucachedict(size) |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
867 |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
868 for op, v in mixedops: |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
869 if op == 0: |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
870 try: |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
871 d[v] |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
872 except KeyError: |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
873 pass |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
874 else: |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
875 d[v] = v |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
876 |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
877 benches = [ |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
878 (doinit, 'init'), |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
879 (dogets, 'gets'), |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
880 (dosets, 'sets'), |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
881 (domixed, 'mixed') |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
882 ] |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
883 |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
884 for fn, title in benches: |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
885 timer, fm = gettimer(ui, opts) |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
886 timer(fn, title=title) |
528cf1a73ae5
perf: add perflrucachedict command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27100
diff
changeset
|
887 fm.end() |
29495
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
888 |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
889 def uisetup(ui): |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
890 if (util.safehasattr(cmdutil, 'openrevlog') and |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
891 not util.safehasattr(commands, 'debugrevlogopts')): |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
892 # for "historical portability": |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
893 # In this case, Mercurial should be 1.9 (or a79fea6b3e77) - |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
894 # 3.7 (or 5606f7d0d063). Therefore, '--dir' option for |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
895 # openrevlog() should cause failure, because it has been |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
896 # available since 3.5 (or 49c583ca48c4). |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
897 def openrevlog(orig, repo, cmd, file_, opts): |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
898 if opts.get('dir') and not util.safehasattr(repo, 'dirlog'): |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
899 raise error.Abort("This version doesn't support --dir option", |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
900 hint="use 3.5 or later") |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
901 return orig(repo, cmd, file_, opts) |
f83445296213
perf: use locally defined revlog option list for Mercurial earlier than 3.7
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29494
diff
changeset
|
902 extensions.wrapfunction(cmdutil, 'openrevlog', openrevlog) |