Show More
@@ -925,6 +925,71 b' def perfancestorset(ui, repo, revset, **' | |||||
925 | fm.end() |
|
925 | fm.end() | |
926 |
|
926 | |||
927 |
|
927 | |||
|
928 | @command( | |||
|
929 | b'perf::delta-find', | |||
|
930 | revlogopts + formatteropts, | |||
|
931 | b'-c|-m|FILE REV', | |||
|
932 | ) | |||
|
933 | def perf_delta_find(ui, repo, arg_1, arg_2=None, **opts): | |||
|
934 | """benchmark the process of finding a valid delta for a revlog revision | |||
|
935 | ||||
|
936 | When a revlog receives a new revision (e.g. from a commit, or from an | |||
|
937 | incoming bundle), it searches for a suitable delta-base to produce a delta. | |||
|
938 | This perf command measures how much time we spend in this process. It | |||
|
939 | operates on an already stored revision. | |||
|
940 | ||||
|
941 | See `hg help debug-delta-find` for another related command. | |||
|
942 | """ | |||
|
943 | from mercurial import revlogutils | |||
|
944 | import mercurial.revlogutils.deltas as deltautil | |||
|
945 | ||||
|
946 | opts = _byteskwargs(opts) | |||
|
947 | if arg_2 is None: | |||
|
948 | file_ = None | |||
|
949 | rev = arg_1 | |||
|
950 | else: | |||
|
951 | file_ = arg_1 | |||
|
952 | rev = arg_2 | |||
|
953 | ||||
|
954 | repo = repo.unfiltered() | |||
|
955 | ||||
|
956 | timer, fm = gettimer(ui, opts) | |||
|
957 | ||||
|
958 | rev = int(rev) | |||
|
959 | ||||
|
960 | revlog = cmdutil.openrevlog(repo, b'perf::delta-find', file_, opts) | |||
|
961 | ||||
|
962 | deltacomputer = deltautil.deltacomputer(revlog) | |||
|
963 | ||||
|
964 | node = revlog.node(rev) | |||
|
965 | p1r, p2r = revlog.parentrevs(rev) | |||
|
966 | p1 = revlog.node(p1r) | |||
|
967 | p2 = revlog.node(p2r) | |||
|
968 | full_text = revlog.revision(rev) | |||
|
969 | textlen = len(full_text) | |||
|
970 | cachedelta = None | |||
|
971 | flags = revlog.flags(rev) | |||
|
972 | ||||
|
973 | revinfo = revlogutils.revisioninfo( | |||
|
974 | node, | |||
|
975 | p1, | |||
|
976 | p2, | |||
|
977 | [full_text], # btext | |||
|
978 | textlen, | |||
|
979 | cachedelta, | |||
|
980 | flags, | |||
|
981 | ) | |||
|
982 | ||||
|
983 | # Note: we should probably purge the potential caches (like the full | |||
|
984 | # manifest cache) between runs. | |||
|
985 | def find_one(): | |||
|
986 | with revlog._datafp() as fh: | |||
|
987 | deltacomputer.finddeltainfo(revinfo, fh, target_rev=rev) | |||
|
988 | ||||
|
989 | timer(find_one) | |||
|
990 | fm.end() | |||
|
991 | ||||
|
992 | ||||
928 | @command(b'perf::discovery|perfdiscovery', formatteropts, b'PATH') |
|
993 | @command(b'perf::discovery|perfdiscovery', formatteropts, b'PATH') | |
929 | def perfdiscovery(ui, repo, path, **opts): |
|
994 | def perfdiscovery(ui, repo, path, **opts): | |
930 | """benchmark discovery between local repo and the peer at given path""" |
|
995 | """benchmark discovery between local repo and the peer at given path""" |
@@ -106,6 +106,9 b' perfstatus' | |||||
106 | (no help text available) |
|
106 | (no help text available) | |
107 | perf::ctxfiles |
|
107 | perf::ctxfiles | |
108 | (no help text available) |
|
108 | (no help text available) | |
|
109 | perf::delta-find | |||
|
110 | benchmark the process of finding a valid delta for a revlog | |||
|
111 | revision | |||
109 | perf::diffwd Profile diff of working directory changes |
|
112 | perf::diffwd Profile diff of working directory changes | |
110 | perf::dirfoldmap |
|
113 | perf::dirfoldmap | |
111 | benchmap a 'dirstate._map.dirfoldmap.get()' request |
|
114 | benchmap a 'dirstate._map.dirfoldmap.get()' request |
General Comments 0
You need to be logged in to leave comments.
Login now