Show More
@@ -1069,6 +1069,7 b' def perfindex(ui, repo, **opts):' | |||
|
1069 | 1069 | |
|
1070 | 1070 | @command(b'perfnodemap', [ |
|
1071 | 1071 |
|
|
1072 | (b'', b'clear-caches', True, b'clear revlog cache between calls'), | |
|
1072 | 1073 | ] + formatteropts) |
|
1073 | 1074 | def perfnodemap(ui, repo, **opts): |
|
1074 | 1075 | """benchmark the time necessary to look up revision from a cold nodemap |
@@ -1093,6 +1094,7 b' def perfnodemap(ui, repo, **opts):' | |||
|
1093 | 1094 | mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg |
|
1094 | 1095 | |
|
1095 | 1096 | unfi = repo.unfiltered() |
|
1097 | clearcaches = opts['clear_caches'] | |
|
1096 | 1098 | # find the filecache func directly |
|
1097 | 1099 | # This avoid polluting the benchmark with the filecache logic |
|
1098 | 1100 | makecl = unfi.__class__.changelog.func |
@@ -1109,13 +1111,18 b' def perfnodemap(ui, repo, **opts):' | |||
|
1109 | 1111 | clearchangelog(unfi) |
|
1110 | 1112 | nodeget[0] = makecl(unfi).nodemap.get |
|
1111 | 1113 | |
|
1112 | def setup(): | |
|
1113 | setnodeget() | |
|
1114 | 1114 | def d(): |
|
1115 | 1115 | get = nodeget[0] |
|
1116 | 1116 | for n in nodes: |
|
1117 | 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 | 1126 | timer(d, setup=setup) |
|
1120 | 1127 | fm.end() |
|
1121 | 1128 |
General Comments 0
You need to be logged in to leave comments.
Login now