##// END OF EJS Templates
perf: add a --[no-]clear-caches option to `perfnodemap`...
Boris Feld -
r41611:d1a27307 default
parent child Browse files
Show More
@@ -1068,7 +1068,8 b' def perfindex(ui, repo, **opts):'
1068 fm.end()
1068 fm.end()
1069
1069
1070 @command(b'perfnodemap', [
1070 @command(b'perfnodemap', [
1071 (b'', b'rev', [], b'revision to be looked up (default tip)'),
1071 (b'', b'rev', [], b'revision to be looked up (default tip)'),
1072 (b'', b'clear-caches', True, b'clear revlog cache between calls'),
1072 ] + formatteropts)
1073 ] + formatteropts)
1073 def perfnodemap(ui, repo, **opts):
1074 def perfnodemap(ui, repo, **opts):
1074 """benchmark the time necessary to look up revision from a cold nodemap
1075 """benchmark the time necessary to look up revision from a cold nodemap
@@ -1093,6 +1094,7 b' def perfnodemap(ui, repo, **opts):'
1093 mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg
1094 mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg
1094
1095
1095 unfi = repo.unfiltered()
1096 unfi = repo.unfiltered()
1097 clearcaches = opts['clear_caches']
1096 # find the filecache func directly
1098 # find the filecache func directly
1097 # This avoid polluting the benchmark with the filecache logic
1099 # This avoid polluting the benchmark with the filecache logic
1098 makecl = unfi.__class__.changelog.func
1100 makecl = unfi.__class__.changelog.func
@@ -1109,13 +1111,18 b' def perfnodemap(ui, repo, **opts):'
1109 clearchangelog(unfi)
1111 clearchangelog(unfi)
1110 nodeget[0] = makecl(unfi).nodemap.get
1112 nodeget[0] = makecl(unfi).nodemap.get
1111
1113
1112 def setup():
1113 setnodeget()
1114 def d():
1114 def d():
1115 get = nodeget[0]
1115 get = nodeget[0]
1116 for n in nodes:
1116 for n in nodes:
1117 get(n)
1117 get(n)
1118
1118
1119 setup = None
1120 if clearcaches:
1121 def setup():
1122 setnodeget()
1123 else:
1124 setnodeget()
1125 d() # prewarm the data structure
1119 timer(d, setup=setup)
1126 timer(d, setup=setup)
1120 fm.end()
1127 fm.end()
1121
1128
General Comments 0
You need to be logged in to leave comments. Login now