##// END OF EJS Templates
perf: introduce a `--contains` flag to the `perfdirstate` command...
marmoute -
r43468:0c4efb6e default
parent child Browse files
Show More
@@ -1101,10 +1101,24 b' def perfdirs(ui, repo, **opts):'
1101 1101 fm.end()
1102 1102
1103 1103
1104 @command(b'perfdirstate', [
1105 (b'', b'iteration', None,
1106 b'benchmark a full iteration for the dirstate'),
1107 ] + formatteropts)
1104 @command(
1105 b'perfdirstate',
1106 [
1107 (
1108 b'',
1109 b'iteration',
1110 None,
1111 b'benchmark a full iteration for the dirstate',
1112 ),
1113 (
1114 b'',
1115 b'contains',
1116 None,
1117 b'benchmark a large amount of `nf in dirstate` calls',
1118 ),
1119 ]
1120 + formatteropts,
1121 )
1108 1122 def perfdirstate(ui, repo, **opts):
1109 1123 """benchmap the time of various distate operations
1110 1124
@@ -1116,13 +1130,31 b' def perfdirstate(ui, repo, **opts):'
1116 1130 timer, fm = gettimer(ui, opts)
1117 1131 b"a" in repo.dirstate
1118 1132
1133 if opts[b'iteration'] and opts[b'contains']:
1134 msg = b'only specify one of --iteration or --contains'
1135 raise error.Abort(msg)
1136
1119 1137 if opts[b'iteration']:
1120 1138 setup = None
1121 1139 dirstate = repo.dirstate
1140
1122 1141 def d():
1123 1142 for f in dirstate:
1124 1143 pass
1144
1145 elif opts[b'contains']:
1146 setup = None
1147 dirstate = repo.dirstate
1148 allfiles = list(dirstate)
1149 # also add file path that will be "missing" from the dirstate
1150 allfiles.extend([f[::-1] for f in allfiles])
1151
1152 def d():
1153 for f in allfiles:
1154 f in dirstate
1155
1125 1156 else:
1157
1126 1158 def setup():
1127 1159 repo.dirstate.invalidate()
1128 1160
@@ -205,6 +205,7 b' perfstatus'
205 205 $ hg perfdirfoldmap
206 206 $ hg perfdirs
207 207 $ hg perfdirstate
208 $ hg perfdirstate --contains
208 209 $ hg perfdirstate --iteration
209 210 $ hg perfdirstatedirs
210 211 $ hg perfdirstatefoldmap
General Comments 0
You need to be logged in to leave comments. Login now