Show More
@@ -46,8 +46,21 b' def perfstatus(ui, repo, *pats):' | |||||
46 | # False)))) |
|
46 | # False)))) | |
47 | timer(lambda: sum(map(len, repo.status()))) |
|
47 | timer(lambda: sum(map(len, repo.status()))) | |
48 |
|
48 | |||
|
49 | def clearcaches(cl): | |||
|
50 | # behave somewhat consistently across internal API changes | |||
|
51 | if util.safehasattr(cl, 'clearcaches'): | |||
|
52 | cl.clearcaches() | |||
|
53 | elif util.safehasattr(cl, '_nodecache'): | |||
|
54 | from mercurial.node import nullid, nullrev | |||
|
55 | cl._nodecache = {nullid: nullrev} | |||
|
56 | cl._nodepos = None | |||
|
57 | ||||
49 | def perfheads(ui, repo): |
|
58 | def perfheads(ui, repo): | |
50 | timer(lambda: len(repo.changelog.headrevs())) |
|
59 | cl = repo.changelog | |
|
60 | def d(): | |||
|
61 | len(cl.headrevs()) | |||
|
62 | clearcaches(cl) | |||
|
63 | timer(d) | |||
51 |
|
64 | |||
52 | def perftags(ui, repo): |
|
65 | def perftags(ui, repo): | |
53 | import mercurial.changelog, mercurial.manifest |
|
66 | import mercurial.changelog, mercurial.manifest | |
@@ -126,20 +139,9 b' def perfnodelookup(ui, repo, rev):' | |||||
126 | mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg |
|
139 | mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg | |
127 | n = repo[rev].node() |
|
140 | n = repo[rev].node() | |
128 | cl = mercurial.revlog.revlog(repo.sopener, "00changelog.i") |
|
141 | cl = mercurial.revlog.revlog(repo.sopener, "00changelog.i") | |
129 | # behave somewhat consistently across internal API changes |
|
|||
130 | if util.safehasattr(cl, 'clearcaches'): |
|
|||
131 | clearcaches = cl.clearcaches |
|
|||
132 | elif util.safehasattr(cl, '_nodecache'): |
|
|||
133 | from mercurial.node import nullid, nullrev |
|
|||
134 | def clearcaches(): |
|
|||
135 | cl._nodecache = {nullid: nullrev} |
|
|||
136 | cl._nodepos = None |
|
|||
137 | else: |
|
|||
138 | def clearcaches(): |
|
|||
139 | pass |
|
|||
140 | def d(): |
|
142 | def d(): | |
141 | cl.rev(n) |
|
143 | cl.rev(n) | |
142 | clearcaches() |
|
144 | clearcaches(cl) | |
143 | timer(d) |
|
145 | timer(d) | |
144 |
|
146 | |||
145 | def perflog(ui, repo, **opts): |
|
147 | def perflog(ui, repo, **opts): |
General Comments 0
You need to be logged in to leave comments.
Login now