##// END OF EJS Templates
perf: add a perfnodemap command...
Boris Feld -
r41610:c9ff9388 default
parent child Browse files
Show More
@@ -1036,7 +1036,8 b' def perfindex(ui, repo, **opts):'
1036 * -10000:
1036 * -10000:
1037 * -10000: + 0
1037 * -10000: + 0
1038
1038
1039 It is not currently possible to check for lookup of a missing node."""
1039 It is not currently possible to check for lookup of a missing node. For
1040 deeper lookup benchmarking, checkout the `perfnodemap` command."""
1040 import mercurial.revlog
1041 import mercurial.revlog
1041 opts = _byteskwargs(opts)
1042 opts = _byteskwargs(opts)
1042 timer, fm = gettimer(ui, opts)
1043 timer, fm = gettimer(ui, opts)
@@ -1066,6 +1067,58 b' def perfindex(ui, repo, **opts):'
1066 timer(d, setup=setup)
1067 timer(d, setup=setup)
1067 fm.end()
1068 fm.end()
1068
1069
1070 @command(b'perfnodemap', [
1071 (b'', b'rev', [], b'revision to be looked up (default tip)'),
1072 ] + formatteropts)
1073 def perfnodemap(ui, repo, **opts):
1074 """benchmark the time necessary to look up revision from a cold nodemap
1075
1076 Depending on the implementation, the amount and order of revision we look
1077 up can varies. Example of useful set to test:
1078 * tip
1079 * 0
1080 * -10:
1081 * :10
1082 * -10: + :10
1083 * :10: + -10:
1084 * -10000:
1085 * -10000: + 0
1086
1087 The command currently focus on valid binary lookup. Benchmarking for
1088 hexlookup, prefix lookup and missing lookup would also be valuable.
1089 """
1090 import mercurial.revlog
1091 opts = _byteskwargs(opts)
1092 timer, fm = gettimer(ui, opts)
1093 mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg
1094
1095 unfi = repo.unfiltered()
1096 # find the filecache func directly
1097 # This avoid polluting the benchmark with the filecache logic
1098 makecl = unfi.__class__.changelog.func
1099 if not opts[b'rev']:
1100 raise error.Abort('use --rev to specify revisions to look up')
1101 revs = scmutil.revrange(repo, opts[b'rev'])
1102 cl = repo.changelog
1103 nodes = [cl.node(r) for r in revs]
1104
1105 # use a list to pass reference to a nodemap from one closure to the next
1106 nodeget = [None]
1107 def setnodeget():
1108 # probably not necessary, but for good measure
1109 clearchangelog(unfi)
1110 nodeget[0] = makecl(unfi).nodemap.get
1111
1112 def setup():
1113 setnodeget()
1114 def d():
1115 get = nodeget[0]
1116 for n in nodes:
1117 get(n)
1118
1119 timer(d, setup=setup)
1120 fm.end()
1121
1069 @command(b'perfstartup', formatteropts)
1122 @command(b'perfstartup', formatteropts)
1070 def perfstartup(ui, repo, **opts):
1123 def perfstartup(ui, repo, **opts):
1071 opts = _byteskwargs(opts)
1124 opts = _byteskwargs(opts)
@@ -109,6 +109,8 b' perfstatus'
109 perfmoonwalk benchmark walking the changelog backwards
109 perfmoonwalk benchmark walking the changelog backwards
110 perfnodelookup
110 perfnodelookup
111 (no help text available)
111 (no help text available)
112 perfnodemap benchmark the time necessary to look up revision from a cold
113 nodemap
112 perfparents (no help text available)
114 perfparents (no help text available)
113 perfpathcopies
115 perfpathcopies
114 benchmark the copy tracing logic
116 benchmark the copy tracing logic
General Comments 0
You need to be logged in to leave comments. Login now