742 |
742 |
743 |
743 |
744 # perf commands |
744 # perf commands |
745 |
745 |
746 |
746 |
747 @command(b'perf--walk', formatteropts) |
747 @command(b'perf::walk|perfwalk', formatteropts) |
748 def perfwalk(ui, repo, *pats, **opts): |
748 def perfwalk(ui, repo, *pats, **opts): |
749 opts = _byteskwargs(opts) |
749 opts = _byteskwargs(opts) |
750 timer, fm = gettimer(ui, opts) |
750 timer, fm = gettimer(ui, opts) |
751 m = scmutil.match(repo[None], pats, {}) |
751 m = scmutil.match(repo[None], pats, {}) |
752 timer( |
752 timer( |
757 ) |
757 ) |
758 ) |
758 ) |
759 fm.end() |
759 fm.end() |
760 |
760 |
761 |
761 |
762 @command(b'perf--annotate', formatteropts) |
762 @command(b'perf::annotate|perfannotate', formatteropts) |
763 def perfannotate(ui, repo, f, **opts): |
763 def perfannotate(ui, repo, f, **opts): |
764 opts = _byteskwargs(opts) |
764 opts = _byteskwargs(opts) |
765 timer, fm = gettimer(ui, opts) |
765 timer, fm = gettimer(ui, opts) |
766 fc = repo[b'.'][f] |
766 fc = repo[b'.'][f] |
767 timer(lambda: len(fc.annotate(True))) |
767 timer(lambda: len(fc.annotate(True))) |
768 fm.end() |
768 fm.end() |
769 |
769 |
770 |
770 |
771 @command( |
771 @command( |
772 b'perf--status', |
772 b'perf::status|perfstatus', |
773 [ |
773 [ |
774 (b'u', b'unknown', False, b'ask status to look for unknown files'), |
774 (b'u', b'unknown', False, b'ask status to look for unknown files'), |
775 (b'', b'dirstate', False, b'benchmark the internal dirstate call'), |
775 (b'', b'dirstate', False, b'benchmark the internal dirstate call'), |
776 ] |
776 ] |
777 + formatteropts, |
777 + formatteropts, |
804 else: |
804 else: |
805 timer(lambda: sum(map(len, repo.status(unknown=opts[b'unknown'])))) |
805 timer(lambda: sum(map(len, repo.status(unknown=opts[b'unknown'])))) |
806 fm.end() |
806 fm.end() |
807 |
807 |
808 |
808 |
809 @command(b'perf--addremove', formatteropts) |
809 @command(b'perf::addremove|perfaddremove', formatteropts) |
810 def perfaddremove(ui, repo, **opts): |
810 def perfaddremove(ui, repo, **opts): |
811 opts = _byteskwargs(opts) |
811 opts = _byteskwargs(opts) |
812 timer, fm = gettimer(ui, opts) |
812 timer, fm = gettimer(ui, opts) |
813 try: |
813 try: |
814 oldquiet = repo.ui.quiet |
814 oldquiet = repo.ui.quiet |
835 |
835 |
836 cl._nodecache = {nullid: nullrev} |
836 cl._nodecache = {nullid: nullrev} |
837 cl._nodepos = None |
837 cl._nodepos = None |
838 |
838 |
839 |
839 |
840 @command(b'perf--heads', formatteropts) |
840 @command(b'perf::heads|perfheads', formatteropts) |
841 def perfheads(ui, repo, **opts): |
841 def perfheads(ui, repo, **opts): |
842 """benchmark the computation of a changelog heads""" |
842 """benchmark the computation of a changelog heads""" |
843 opts = _byteskwargs(opts) |
843 opts = _byteskwargs(opts) |
844 timer, fm = gettimer(ui, opts) |
844 timer, fm = gettimer(ui, opts) |
845 cl = repo.changelog |
845 cl = repo.changelog |
878 |
878 |
879 timer(t, setup=s) |
879 timer(t, setup=s) |
880 fm.end() |
880 fm.end() |
881 |
881 |
882 |
882 |
883 @command(b'perf--ancestors', formatteropts) |
883 @command(b'perf::ancestors|perfancestors', formatteropts) |
884 def perfancestors(ui, repo, **opts): |
884 def perfancestors(ui, repo, **opts): |
885 opts = _byteskwargs(opts) |
885 opts = _byteskwargs(opts) |
886 timer, fm = gettimer(ui, opts) |
886 timer, fm = gettimer(ui, opts) |
887 heads = repo.changelog.headrevs() |
887 heads = repo.changelog.headrevs() |
888 |
888 |
892 |
892 |
893 timer(d) |
893 timer(d) |
894 fm.end() |
894 fm.end() |
895 |
895 |
896 |
896 |
897 @command(b'perf--ancestorset', formatteropts) |
897 @command(b'perf::ancestorset|perfancestorset', formatteropts) |
898 def perfancestorset(ui, repo, revset, **opts): |
898 def perfancestorset(ui, repo, revset, **opts): |
899 opts = _byteskwargs(opts) |
899 opts = _byteskwargs(opts) |
900 timer, fm = gettimer(ui, opts) |
900 timer, fm = gettimer(ui, opts) |
901 revs = repo.revs(revset) |
901 revs = repo.revs(revset) |
902 heads = repo.changelog.headrevs() |
902 heads = repo.changelog.headrevs() |
908 |
908 |
909 timer(d) |
909 timer(d) |
910 fm.end() |
910 fm.end() |
911 |
911 |
912 |
912 |
913 @command(b'perf--discovery', formatteropts, b'PATH') |
913 @command(b'perf::discovery|perfdiscovery', formatteropts, b'PATH') |
914 def perfdiscovery(ui, repo, path, **opts): |
914 def perfdiscovery(ui, repo, path, **opts): |
915 """benchmark discovery between local repo and the peer at given path""" |
915 """benchmark discovery between local repo and the peer at given path""" |
916 repos = [repo, None] |
916 repos = [repo, None] |
917 timer, fm = gettimer(ui, opts) |
917 timer, fm = gettimer(ui, opts) |
918 path = ui.expandpath(path) |
918 path = ui.expandpath(path) |
951 |
951 |
952 timer(d, setup=s) |
952 timer(d, setup=s) |
953 fm.end() |
953 fm.end() |
954 |
954 |
955 |
955 |
956 @command(b'perf--bundleread', formatteropts, b'BUNDLE') |
956 @command(b'perf::bundleread|perfbundleread', formatteropts, b'BUNDLE') |
957 def perfbundleread(ui, repo, bundlepath, **opts): |
957 def perfbundleread(ui, repo, bundlepath, **opts): |
958 """Benchmark reading of bundle files. |
958 """Benchmark reading of bundle files. |
959 |
959 |
960 This command is meant to isolate the I/O part of bundle reading as |
960 This command is meant to isolate the I/O part of bundle reading as |
961 much as possible. |
961 much as possible. |
1078 timer(fn, title=title) |
1078 timer(fn, title=title) |
1079 fm.end() |
1079 fm.end() |
1080 |
1080 |
1081 |
1081 |
1082 @command( |
1082 @command( |
1083 b'perf--changegroupchangelog', |
1083 b'perf::changegroupchangelog|perfchangegroupchangelog', |
1084 formatteropts |
1084 formatteropts |
1085 + [ |
1085 + [ |
1086 (b'', b'cgversion', b'02', b'changegroup version'), |
1086 (b'', b'cgversion', b'02', b'changegroup version'), |
1087 (b'r', b'rev', b'', b'revisions to add to changegroup'), |
1087 (b'r', b'rev', b'', b'revisions to add to changegroup'), |
1088 ], |
1088 ], |
1114 timer(d) |
1114 timer(d) |
1115 |
1115 |
1116 fm.end() |
1116 fm.end() |
1117 |
1117 |
1118 |
1118 |
1119 @command(b'perf--dirs', formatteropts) |
1119 @command(b'perf::dirs|perfdirs', formatteropts) |
1120 def perfdirs(ui, repo, **opts): |
1120 def perfdirs(ui, repo, **opts): |
1121 opts = _byteskwargs(opts) |
1121 opts = _byteskwargs(opts) |
1122 timer, fm = gettimer(ui, opts) |
1122 timer, fm = gettimer(ui, opts) |
1123 dirstate = repo.dirstate |
1123 dirstate = repo.dirstate |
1124 b'a' in dirstate |
1124 b'a' in dirstate |
1193 |
1193 |
1194 timer(d, setup=setup) |
1194 timer(d, setup=setup) |
1195 fm.end() |
1195 fm.end() |
1196 |
1196 |
1197 |
1197 |
1198 @command(b'perf--dirstatedirs', formatteropts) |
1198 @command(b'perf::dirstatedirs|perfdirstatedirs', formatteropts) |
1199 def perfdirstatedirs(ui, repo, **opts): |
1199 def perfdirstatedirs(ui, repo, **opts): |
1200 """benchmap a 'dirstate.hasdir' call from an empty `dirs` cache""" |
1200 """benchmap a 'dirstate.hasdir' call from an empty `dirs` cache""" |
1201 opts = _byteskwargs(opts) |
1201 opts = _byteskwargs(opts) |
1202 timer, fm = gettimer(ui, opts) |
1202 timer, fm = gettimer(ui, opts) |
1203 repo.dirstate.hasdir(b"a") |
1203 repo.dirstate.hasdir(b"a") |
1210 |
1210 |
1211 timer(d, setup=setup) |
1211 timer(d, setup=setup) |
1212 fm.end() |
1212 fm.end() |
1213 |
1213 |
1214 |
1214 |
1215 @command(b'perf--dirstatefoldmap', formatteropts) |
1215 @command(b'perf::dirstatefoldmap|perfdirstatefoldmap', formatteropts) |
1216 def perfdirstatefoldmap(ui, repo, **opts): |
1216 def perfdirstatefoldmap(ui, repo, **opts): |
1217 """benchmap a `dirstate._map.filefoldmap.get()` request |
1217 """benchmap a `dirstate._map.filefoldmap.get()` request |
1218 |
1218 |
1219 The dirstate filefoldmap cache is dropped between every request. |
1219 The dirstate filefoldmap cache is dropped between every request. |
1220 """ |
1220 """ |
1231 |
1231 |
1232 timer(d, setup=setup) |
1232 timer(d, setup=setup) |
1233 fm.end() |
1233 fm.end() |
1234 |
1234 |
1235 |
1235 |
1236 @command(b'perf--dirfoldmap', formatteropts) |
1236 @command(b'perf::dirfoldmap|perfdirfoldmap', formatteropts) |
1237 def perfdirfoldmap(ui, repo, **opts): |
1237 def perfdirfoldmap(ui, repo, **opts): |
1238 """benchmap a `dirstate._map.dirfoldmap.get()` request |
1238 """benchmap a `dirstate._map.dirfoldmap.get()` request |
1239 |
1239 |
1240 The dirstate dirfoldmap cache is dropped between every request. |
1240 The dirstate dirfoldmap cache is dropped between every request. |
1241 """ |
1241 """ |
1253 |
1253 |
1254 timer(d, setup=setup) |
1254 timer(d, setup=setup) |
1255 fm.end() |
1255 fm.end() |
1256 |
1256 |
1257 |
1257 |
1258 @command(b'perf--dirstatewrite', formatteropts) |
1258 @command(b'perf::dirstatewrite|perfdirstatewrite', formatteropts) |
1259 def perfdirstatewrite(ui, repo, **opts): |
1259 def perfdirstatewrite(ui, repo, **opts): |
1260 """benchmap the time it take to write a dirstate on disk""" |
1260 """benchmap the time it take to write a dirstate on disk""" |
1261 opts = _byteskwargs(opts) |
1261 opts = _byteskwargs(opts) |
1262 timer, fm = gettimer(ui, opts) |
1262 timer, fm = gettimer(ui, opts) |
1263 ds = repo.dirstate |
1263 ds = repo.dirstate |
1295 ancestor = wctx.ancestor(rctx) |
1295 ancestor = wctx.ancestor(rctx) |
1296 return (wctx, rctx, ancestor) |
1296 return (wctx, rctx, ancestor) |
1297 |
1297 |
1298 |
1298 |
1299 @command( |
1299 @command( |
1300 b'perf--mergecalculate', |
1300 b'perf::mergecalculate|perfmergecalculate', |
1301 [ |
1301 [ |
1302 (b'r', b'rev', b'.', b'rev to merge against'), |
1302 (b'r', b'rev', b'.', b'rev to merge against'), |
1303 (b'', b'from', b'', b'rev to merge from'), |
1303 (b'', b'from', b'', b'rev to merge from'), |
1304 (b'', b'base', b'', b'the revision to use as base'), |
1304 (b'', b'base', b'', b'the revision to use as base'), |
1305 ] |
1305 ] |
1328 timer(d) |
1328 timer(d) |
1329 fm.end() |
1329 fm.end() |
1330 |
1330 |
1331 |
1331 |
1332 @command( |
1332 @command( |
1333 b'perf--mergecopies', |
1333 b'perf::mergecopies|perfmergecopies', |
1334 [ |
1334 [ |
1335 (b'r', b'rev', b'.', b'rev to merge against'), |
1335 (b'r', b'rev', b'.', b'rev to merge against'), |
1336 (b'', b'from', b'', b'rev to merge from'), |
1336 (b'', b'from', b'', b'rev to merge from'), |
1337 (b'', b'base', b'', b'the revision to use as base'), |
1337 (b'', b'base', b'', b'the revision to use as base'), |
1338 ] |
1338 ] |
1351 |
1351 |
1352 timer(d) |
1352 timer(d) |
1353 fm.end() |
1353 fm.end() |
1354 |
1354 |
1355 |
1355 |
1356 @command(b'perf--pathcopies', [], b"REV REV") |
1356 @command(b'perf::pathcopies|perfpathcopies', [], b"REV REV") |
1357 def perfpathcopies(ui, repo, rev1, rev2, **opts): |
1357 def perfpathcopies(ui, repo, rev1, rev2, **opts): |
1358 """benchmark the copy tracing logic""" |
1358 """benchmark the copy tracing logic""" |
1359 opts = _byteskwargs(opts) |
1359 opts = _byteskwargs(opts) |
1360 timer, fm = gettimer(ui, opts) |
1360 timer, fm = gettimer(ui, opts) |
1361 ctx1 = scmutil.revsingle(repo, rev1, rev1) |
1361 ctx1 = scmutil.revsingle(repo, rev1, rev1) |
1392 |
1392 |
1393 timer(d) |
1393 timer(d) |
1394 fm.end() |
1394 fm.end() |
1395 |
1395 |
1396 |
1396 |
1397 @command(b'perf--phasesremote', [], b"[DEST]") |
1397 @command(b'perf::phasesremote|perfphasesremote', [], b"[DEST]") |
1398 def perfphasesremote(ui, repo, dest=None, **opts): |
1398 def perfphasesremote(ui, repo, dest=None, **opts): |
1399 """benchmark time needed to analyse phases of the remote server""" |
1399 """benchmark time needed to analyse phases of the remote server""" |
1400 from mercurial.node import bin |
1400 from mercurial.node import bin |
1401 from mercurial import ( |
1401 from mercurial import ( |
1402 exchange, |
1402 exchange, |
1453 timer(d) |
1453 timer(d) |
1454 fm.end() |
1454 fm.end() |
1455 |
1455 |
1456 |
1456 |
1457 @command( |
1457 @command( |
1458 b'perf--manifest', |
1458 b'perf::manifest|perfmanifest', |
1459 [ |
1459 [ |
1460 (b'm', b'manifest-rev', False, b'Look up a manifest node revision'), |
1460 (b'm', b'manifest-rev', False, b'Look up a manifest node revision'), |
1461 (b'', b'clear-disk', False, b'clear on-disk caches too'), |
1461 (b'', b'clear-disk', False, b'clear on-disk caches too'), |
1462 ] |
1462 ] |
1463 + formatteropts, |
1463 + formatteropts, |
1497 |
1497 |
1498 timer(d) |
1498 timer(d) |
1499 fm.end() |
1499 fm.end() |
1500 |
1500 |
1501 |
1501 |
1502 @command(b'perf--changeset', formatteropts) |
1502 @command(b'perf::changeset|perfchangeset', formatteropts) |
1503 def perfchangeset(ui, repo, rev, **opts): |
1503 def perfchangeset(ui, repo, rev, **opts): |
1504 opts = _byteskwargs(opts) |
1504 opts = _byteskwargs(opts) |
1505 timer, fm = gettimer(ui, opts) |
1505 timer, fm = gettimer(ui, opts) |
1506 n = scmutil.revsingle(repo, rev).node() |
1506 n = scmutil.revsingle(repo, rev).node() |
1507 |
1507 |
1511 |
1511 |
1512 timer(d) |
1512 timer(d) |
1513 fm.end() |
1513 fm.end() |
1514 |
1514 |
1515 |
1515 |
1516 @command(b'perf--ignore', formatteropts) |
1516 @command(b'perf::ignore|perfignore', formatteropts) |
1517 def perfignore(ui, repo, **opts): |
1517 def perfignore(ui, repo, **opts): |
1518 """benchmark operation related to computing ignore""" |
1518 """benchmark operation related to computing ignore""" |
1519 opts = _byteskwargs(opts) |
1519 opts = _byteskwargs(opts) |
1520 timer, fm = gettimer(ui, opts) |
1520 timer, fm = gettimer(ui, opts) |
1521 dirstate = repo.dirstate |
1521 dirstate = repo.dirstate |
1530 timer(runone, setup=setupone, title=b"load") |
1530 timer(runone, setup=setupone, title=b"load") |
1531 fm.end() |
1531 fm.end() |
1532 |
1532 |
1533 |
1533 |
1534 @command( |
1534 @command( |
1535 b'perf--index', |
1535 b'perf::index|perfindex', |
1536 [ |
1536 [ |
1537 (b'', b'rev', [], b'revision to be looked up (default tip)'), |
1537 (b'', b'rev', [], b'revision to be looked up (default tip)'), |
1538 (b'', b'no-lookup', None, b'do not revision lookup post creation'), |
1538 (b'', b'no-lookup', None, b'do not revision lookup post creation'), |
1539 ] |
1539 ] |
1540 + formatteropts, |
1540 + formatteropts, |
1594 timer(d, setup=setup) |
1594 timer(d, setup=setup) |
1595 fm.end() |
1595 fm.end() |
1596 |
1596 |
1597 |
1597 |
1598 @command( |
1598 @command( |
1599 b'perf--nodemap', |
1599 b'perf::nodemap|perfnodemap', |
1600 [ |
1600 [ |
1601 (b'', b'rev', [], b'revision to be looked up (default tip)'), |
1601 (b'', b'rev', [], b'revision to be looked up (default tip)'), |
1602 (b'', b'clear-caches', True, b'clear revlog cache between calls'), |
1602 (b'', b'clear-caches', True, b'clear revlog cache between calls'), |
1603 ] |
1603 ] |
1604 + formatteropts, |
1604 + formatteropts, |
1665 d() # prewarm the data structure |
1665 d() # prewarm the data structure |
1666 timer(d, setup=setup) |
1666 timer(d, setup=setup) |
1667 fm.end() |
1667 fm.end() |
1668 |
1668 |
1669 |
1669 |
1670 @command(b'perf--startup', formatteropts) |
1670 @command(b'perf::startup|perfstartup', formatteropts) |
1671 def perfstartup(ui, repo, **opts): |
1671 def perfstartup(ui, repo, **opts): |
1672 opts = _byteskwargs(opts) |
1672 opts = _byteskwargs(opts) |
1673 timer, fm = gettimer(ui, opts) |
1673 timer, fm = gettimer(ui, opts) |
1674 |
1674 |
1675 def d(): |
1675 def d(): |
1683 |
1683 |
1684 timer(d) |
1684 timer(d) |
1685 fm.end() |
1685 fm.end() |
1686 |
1686 |
1687 |
1687 |
1688 @command(b'perf--parents', formatteropts) |
1688 @command(b'perf::parents|perfparents', formatteropts) |
1689 def perfparents(ui, repo, **opts): |
1689 def perfparents(ui, repo, **opts): |
1690 """benchmark the time necessary to fetch one changeset's parents. |
1690 """benchmark the time necessary to fetch one changeset's parents. |
1691 |
1691 |
1692 The fetch is done using the `node identifier`, traversing all object layers |
1692 The fetch is done using the `node identifier`, traversing all object layers |
1693 from the repository object. The first N revisions will be used for this |
1693 from the repository object. The first N revisions will be used for this |
1710 |
1710 |
1711 timer(d) |
1711 timer(d) |
1712 fm.end() |
1712 fm.end() |
1713 |
1713 |
1714 |
1714 |
1715 @command(b'perf--ctxfiles', formatteropts) |
1715 @command(b'perf::ctxfiles|perfctxfiles', formatteropts) |
1716 def perfctxfiles(ui, repo, x, **opts): |
1716 def perfctxfiles(ui, repo, x, **opts): |
1717 opts = _byteskwargs(opts) |
1717 opts = _byteskwargs(opts) |
1718 x = int(x) |
1718 x = int(x) |
1719 timer, fm = gettimer(ui, opts) |
1719 timer, fm = gettimer(ui, opts) |
1720 |
1720 |
1723 |
1723 |
1724 timer(d) |
1724 timer(d) |
1725 fm.end() |
1725 fm.end() |
1726 |
1726 |
1727 |
1727 |
1728 @command(b'perf--rawfiles', formatteropts) |
1728 @command(b'perf::rawfiles|perfrawfiles', formatteropts) |
1729 def perfrawfiles(ui, repo, x, **opts): |
1729 def perfrawfiles(ui, repo, x, **opts): |
1730 opts = _byteskwargs(opts) |
1730 opts = _byteskwargs(opts) |
1731 x = int(x) |
1731 x = int(x) |
1732 timer, fm = gettimer(ui, opts) |
1732 timer, fm = gettimer(ui, opts) |
1733 cl = repo.changelog |
1733 cl = repo.changelog |
1737 |
1737 |
1738 timer(d) |
1738 timer(d) |
1739 fm.end() |
1739 fm.end() |
1740 |
1740 |
1741 |
1741 |
1742 @command(b'perf--lookup', formatteropts) |
1742 @command(b'perf::lookup|perflookup', formatteropts) |
1743 def perflookup(ui, repo, rev, **opts): |
1743 def perflookup(ui, repo, rev, **opts): |
1744 opts = _byteskwargs(opts) |
1744 opts = _byteskwargs(opts) |
1745 timer, fm = gettimer(ui, opts) |
1745 timer, fm = gettimer(ui, opts) |
1746 timer(lambda: len(repo.lookup(rev))) |
1746 timer(lambda: len(repo.lookup(rev))) |
1747 fm.end() |
1747 fm.end() |
1748 |
1748 |
1749 |
1749 |
1750 @command( |
1750 @command( |
1751 b'perf--linelogedits', |
1751 b'perf::linelogedits|perflinelogedits', |
1752 [ |
1752 [ |
1753 (b'n', b'edits', 10000, b'number of edits'), |
1753 (b'n', b'edits', 10000, b'number of edits'), |
1754 (b'', b'max-hunk-lines', 10, b'max lines in a hunk'), |
1754 (b'', b'max-hunk-lines', 10, b'max lines in a hunk'), |
1755 ], |
1755 ], |
1756 norepo=True, |
1756 norepo=True, |
1784 timer, fm = gettimer(ui, opts) |
1784 timer, fm = gettimer(ui, opts) |
1785 timer(d) |
1785 timer(d) |
1786 fm.end() |
1786 fm.end() |
1787 |
1787 |
1788 |
1788 |
1789 @command(b'perf--revrange', formatteropts) |
1789 @command(b'perf::revrange|perfrevrange', formatteropts) |
1790 def perfrevrange(ui, repo, *specs, **opts): |
1790 def perfrevrange(ui, repo, *specs, **opts): |
1791 opts = _byteskwargs(opts) |
1791 opts = _byteskwargs(opts) |
1792 timer, fm = gettimer(ui, opts) |
1792 timer, fm = gettimer(ui, opts) |
1793 revrange = scmutil.revrange |
1793 revrange = scmutil.revrange |
1794 timer(lambda: len(revrange(repo, specs))) |
1794 timer(lambda: len(revrange(repo, specs))) |
1795 fm.end() |
1795 fm.end() |
1796 |
1796 |
1797 |
1797 |
1798 @command(b'perf--nodelookup', formatteropts) |
1798 @command(b'perf::nodelookup|perfnodelookup', formatteropts) |
1799 def perfnodelookup(ui, repo, rev, **opts): |
1799 def perfnodelookup(ui, repo, rev, **opts): |
1800 opts = _byteskwargs(opts) |
1800 opts = _byteskwargs(opts) |
1801 timer, fm = gettimer(ui, opts) |
1801 timer, fm = gettimer(ui, opts) |
1802 import mercurial.revlog |
1802 import mercurial.revlog |
1803 |
1803 |
1812 timer(d) |
1812 timer(d) |
1813 fm.end() |
1813 fm.end() |
1814 |
1814 |
1815 |
1815 |
1816 @command( |
1816 @command( |
1817 b'perf--log', |
1817 b'perf::log|perflog', |
1818 [(b'', b'rename', False, b'ask log to follow renames')] + formatteropts, |
1818 [(b'', b'rename', False, b'ask log to follow renames')] + formatteropts, |
1819 ) |
1819 ) |
1820 def perflog(ui, repo, rev=None, **opts): |
1820 def perflog(ui, repo, rev=None, **opts): |
1821 opts = _byteskwargs(opts) |
1821 opts = _byteskwargs(opts) |
1822 if rev is None: |
1822 if rev is None: |
1830 ) |
1830 ) |
1831 ui.popbuffer() |
1831 ui.popbuffer() |
1832 fm.end() |
1832 fm.end() |
1833 |
1833 |
1834 |
1834 |
1835 @command(b'perf--moonwalk', formatteropts) |
1835 @command(b'perf::moonwalk|perfmoonwalk', formatteropts) |
1836 def perfmoonwalk(ui, repo, **opts): |
1836 def perfmoonwalk(ui, repo, **opts): |
1837 """benchmark walking the changelog backwards |
1837 """benchmark walking the changelog backwards |
1838 |
1838 |
1839 This also loads the changelog data for each revision in the changelog. |
1839 This also loads the changelog data for each revision in the changelog. |
1840 """ |
1840 """ |
1939 fm.plain('%s: %s\n' % (l, stats[l])) |
1939 fm.plain('%s: %s\n' % (l, stats[l])) |
1940 fm.end() |
1940 fm.end() |
1941 |
1941 |
1942 |
1942 |
1943 @command( |
1943 @command( |
1944 b'perf--helper-mergecopies', |
1944 b'perf::helper-mergecopies|perfhelper-mergecopies', |
1945 formatteropts |
1945 formatteropts |
1946 + [ |
1946 + [ |
1947 (b'r', b'revs', [], b'restrict search to these revisions'), |
1947 (b'r', b'revs', [], b'restrict search to these revisions'), |
1948 (b'', b'timing', False, b'provides extra data (costly)'), |
1948 (b'', b'timing', False, b'provides extra data (costly)'), |
1949 (b'', b'stats', False, b'provides statistic about the measured data'), |
1949 (b'', b'stats', False, b'provides statistic about the measured data'), |
2122 entries.append(('totaltime', 'time for both parents')) |
2122 entries.append(('totaltime', 'time for both parents')) |
2123 _displaystats(ui, opts, entries, alldata) |
2123 _displaystats(ui, opts, entries, alldata) |
2124 |
2124 |
2125 |
2125 |
2126 @command( |
2126 @command( |
2127 b'perf--helper-pathcopies', |
2127 b'perf::helper-pathcopies|perfhelper-pathcopies', |
2128 formatteropts |
2128 formatteropts |
2129 + [ |
2129 + [ |
2130 (b'r', b'revs', [], b'restrict search to these revisions'), |
2130 (b'r', b'revs', [], b'restrict search to these revisions'), |
2131 (b'', b'timing', False, b'provides extra data (costly)'), |
2131 (b'', b'timing', False, b'provides extra data (costly)'), |
2132 (b'', b'stats', False, b'provides statistic about the measured data'), |
2132 (b'', b'stats', False, b'provides statistic about the measured data'), |
2261 entries.append(('nbrenames', 'renamed files')) |
2261 entries.append(('nbrenames', 'renamed files')) |
2262 entries.append(('time', 'time')) |
2262 entries.append(('time', 'time')) |
2263 _displaystats(ui, opts, entries, alldata) |
2263 _displaystats(ui, opts, entries, alldata) |
2264 |
2264 |
2265 |
2265 |
2266 @command(b'perf--cca', formatteropts) |
2266 @command(b'perf::cca|perfcca', formatteropts) |
2267 def perfcca(ui, repo, **opts): |
2267 def perfcca(ui, repo, **opts): |
2268 opts = _byteskwargs(opts) |
2268 opts = _byteskwargs(opts) |
2269 timer, fm = gettimer(ui, opts) |
2269 timer, fm = gettimer(ui, opts) |
2270 timer(lambda: scmutil.casecollisionauditor(ui, False, repo.dirstate)) |
2270 timer(lambda: scmutil.casecollisionauditor(ui, False, repo.dirstate)) |
2271 fm.end() |
2271 fm.end() |
2272 |
2272 |
2273 |
2273 |
2274 @command(b'perf--fncacheload', formatteropts) |
2274 @command(b'perf::fncacheload|perffncacheload', formatteropts) |
2275 def perffncacheload(ui, repo, **opts): |
2275 def perffncacheload(ui, repo, **opts): |
2276 opts = _byteskwargs(opts) |
2276 opts = _byteskwargs(opts) |
2277 timer, fm = gettimer(ui, opts) |
2277 timer, fm = gettimer(ui, opts) |
2278 s = repo.store |
2278 s = repo.store |
2279 |
2279 |
2282 |
2282 |
2283 timer(d) |
2283 timer(d) |
2284 fm.end() |
2284 fm.end() |
2285 |
2285 |
2286 |
2286 |
2287 @command(b'perf--fncachewrite', formatteropts) |
2287 @command(b'perf::fncachewrite|perffncachewrite', formatteropts) |
2288 def perffncachewrite(ui, repo, **opts): |
2288 def perffncachewrite(ui, repo, **opts): |
2289 opts = _byteskwargs(opts) |
2289 opts = _byteskwargs(opts) |
2290 timer, fm = gettimer(ui, opts) |
2290 timer, fm = gettimer(ui, opts) |
2291 s = repo.store |
2291 s = repo.store |
2292 lock = repo.lock() |
2292 lock = repo.lock() |
2302 tr.close() |
2302 tr.close() |
2303 lock.release() |
2303 lock.release() |
2304 fm.end() |
2304 fm.end() |
2305 |
2305 |
2306 |
2306 |
2307 @command(b'perf--fncacheencode', formatteropts) |
2307 @command(b'perf::fncacheencode|perffncacheencode', formatteropts) |
2308 def perffncacheencode(ui, repo, **opts): |
2308 def perffncacheencode(ui, repo, **opts): |
2309 opts = _byteskwargs(opts) |
2309 opts = _byteskwargs(opts) |
2310 timer, fm = gettimer(ui, opts) |
2310 timer, fm = gettimer(ui, opts) |
2311 s = repo.store |
2311 s = repo.store |
2312 s.fncache._load() |
2312 s.fncache._load() |
2541 timer, fm = gettimer(ui, opts) |
2541 timer, fm = gettimer(ui, opts) |
2542 timer(d) |
2542 timer(d) |
2543 fm.end() |
2543 fm.end() |
2544 |
2544 |
2545 |
2545 |
2546 @command(b'perf--diffwd', formatteropts) |
2546 @command(b'perf::diffwd|perfdiffwd', formatteropts) |
2547 def perfdiffwd(ui, repo, **opts): |
2547 def perfdiffwd(ui, repo, **opts): |
2548 """Profile diff of working directory changes""" |
2548 """Profile diff of working directory changes""" |
2549 opts = _byteskwargs(opts) |
2549 opts = _byteskwargs(opts) |
2550 timer, fm = gettimer(ui, opts) |
2550 timer, fm = gettimer(ui, opts) |
2551 options = { |
2551 options = { |
2566 title = b'diffopts: %s' % (diffopt and (b'-' + diffopt) or b'none') |
2566 title = b'diffopts: %s' % (diffopt and (b'-' + diffopt) or b'none') |
2567 timer(d, title=title) |
2567 timer(d, title=title) |
2568 fm.end() |
2568 fm.end() |
2569 |
2569 |
2570 |
2570 |
2571 @command(b'perf--revlogindex', revlogopts + formatteropts, b'-c|-m|FILE') |
2571 @command( |
|
2572 b'perf::revlogindex|perfrevlogindex', |
|
2573 revlogopts + formatteropts, |
|
2574 b'-c|-m|FILE', |
|
2575 ) |
2572 def perfrevlogindex(ui, repo, file_=None, **opts): |
2576 def perfrevlogindex(ui, repo, file_=None, **opts): |
2573 """Benchmark operations against a revlog index. |
2577 """Benchmark operations against a revlog index. |
2574 |
2578 |
2575 This tests constructing a revlog instance, reading index data, |
2579 This tests constructing a revlog instance, reading index data, |
2576 parsing index data, and performing various operations related to |
2580 parsing index data, and performing various operations related to |
2702 timer(fn, title=title) |
2706 timer(fn, title=title) |
2703 fm.end() |
2707 fm.end() |
2704 |
2708 |
2705 |
2709 |
2706 @command( |
2710 @command( |
2707 b'perf--revlogrevisions', |
2711 b'perf::revlogrevisions|perfrevlogrevisions', |
2708 revlogopts |
2712 revlogopts |
2709 + formatteropts |
2713 + formatteropts |
2710 + [ |
2714 + [ |
2711 (b'd', b'dist', 100, b'distance between the revisions'), |
2715 (b'd', b'dist', 100, b'distance between the revisions'), |
2712 (b's', b'startrev', 0, b'revision to start reading at'), |
2716 (b's', b'startrev', 0, b'revision to start reading at'), |
2752 timer(d) |
2756 timer(d) |
2753 fm.end() |
2757 fm.end() |
2754 |
2758 |
2755 |
2759 |
2756 @command( |
2760 @command( |
2757 b'perf--revlogwrite', |
2761 b'perf::revlogwrite|perfrevlogwrite', |
2758 revlogopts |
2762 revlogopts |
2759 + formatteropts |
2763 + formatteropts |
2760 + [ |
2764 + [ |
2761 (b's', b'startrev', 1000, b'revision to start writing at'), |
2765 (b's', b'startrev', 1000, b'revision to start writing at'), |
2762 (b'', b'stoprev', -1, b'last revision to write'), |
2766 (b'', b'stoprev', -1, b'last revision to write'), |
3045 finally: |
3049 finally: |
3046 shutil.rmtree(tmpdir, True) |
3050 shutil.rmtree(tmpdir, True) |
3047 |
3051 |
3048 |
3052 |
3049 @command( |
3053 @command( |
3050 b'perf--revlogchunks', |
3054 b'perf::revlogchunks|perfrevlogchunks', |
3051 revlogopts |
3055 revlogopts |
3052 + formatteropts |
3056 + formatteropts |
3053 + [ |
3057 + [ |
3054 (b'e', b'engines', b'', b'compression engines to use'), |
3058 (b'e', b'engines', b'', b'compression engines to use'), |
3055 (b's', b'startrev', 0, b'revision to start at'), |
3059 (b's', b'startrev', 0, b'revision to start at'), |
3174 timer(fn, title=title) |
3178 timer(fn, title=title) |
3175 fm.end() |
3179 fm.end() |
3176 |
3180 |
3177 |
3181 |
3178 @command( |
3182 @command( |
3179 b'perf--revlogrevision', |
3183 b'perf::revlogrevision|perfrevlogrevision', |
3180 revlogopts |
3184 revlogopts |
3181 + formatteropts |
3185 + formatteropts |
3182 + [(b'', b'cache', False, b'use caches instead of clearing')], |
3186 + [(b'', b'cache', False, b'use caches instead of clearing')], |
3183 b'-c|-m|FILE REV', |
3187 b'-c|-m|FILE REV', |
3184 ) |
3188 ) |
3317 timer(fn, title=title) |
3321 timer(fn, title=title) |
3318 fm.end() |
3322 fm.end() |
3319 |
3323 |
3320 |
3324 |
3321 @command( |
3325 @command( |
3322 b'perf--revset', |
3326 b'perf::revset|perfrevset', |
3323 [ |
3327 [ |
3324 (b'C', b'clear', False, b'clear volatile cache between each call.'), |
3328 (b'C', b'clear', False, b'clear volatile cache between each call.'), |
3325 (b'', b'contexts', False, b'obtain changectx for each revision'), |
3329 (b'', b'contexts', False, b'obtain changectx for each revision'), |
3326 ] |
3330 ] |
3327 + formatteropts, |
3331 + formatteropts, |
3490 branchcachewrite.restore() |
3494 branchcachewrite.restore() |
3491 fm.end() |
3495 fm.end() |
3492 |
3496 |
3493 |
3497 |
3494 @command( |
3498 @command( |
3495 b'perf--branchmapupdate', |
3499 b'perf::branchmapupdate|perfbranchmapupdate', |
3496 [ |
3500 [ |
3497 (b'', b'base', [], b'subset of revision to start from'), |
3501 (b'', b'base', [], b'subset of revision to start from'), |
3498 (b'', b'target', [], b'subset of revision to end with'), |
3502 (b'', b'target', [], b'subset of revision to end with'), |
3499 (b'', b'clear-caches', False, b'clear cache between each runs'), |
3503 (b'', b'clear-caches', False, b'clear cache between each runs'), |
3500 ] |
3504 ] |
3600 repoview.filtertable.pop(b'__perf_branchmap_update_base', None) |
3604 repoview.filtertable.pop(b'__perf_branchmap_update_base', None) |
3601 repoview.filtertable.pop(b'__perf_branchmap_update_target', None) |
3605 repoview.filtertable.pop(b'__perf_branchmap_update_target', None) |
3602 |
3606 |
3603 |
3607 |
3604 @command( |
3608 @command( |
3605 b'perf--branchmapload', |
3609 b'perf::branchmapload|perfbranchmapload', |
3606 [ |
3610 [ |
3607 (b'f', b'filter', b'', b'Specify repoview filter'), |
3611 (b'f', b'filter', b'', b'Specify repoview filter'), |
3608 (b'', b'list', False, b'List brachmap filter caches'), |
3612 (b'', b'list', False, b'List brachmap filter caches'), |
3609 (b'', b'clear-revlogs', False, b'refresh changelog and manifest'), |
3613 (b'', b'clear-revlogs', False, b'refresh changelog and manifest'), |
3610 ] |
3614 ] |
3659 |
3663 |
3660 timer(bench, setup=setup) |
3664 timer(bench, setup=setup) |
3661 fm.end() |
3665 fm.end() |
3662 |
3666 |
3663 |
3667 |
3664 @command(b'perf--loadmarkers') |
3668 @command(b'perf::loadmarkers|perfloadmarkers') |
3665 def perfloadmarkers(ui, repo): |
3669 def perfloadmarkers(ui, repo): |
3666 """benchmark the time to parse the on-disk markers for a repo |
3670 """benchmark the time to parse the on-disk markers for a repo |
3667 |
3671 |
3668 Result is the number of markers in the repo.""" |
3672 Result is the number of markers in the repo.""" |
3669 timer, fm = gettimer(ui) |
3673 timer, fm = gettimer(ui) |
3671 timer(lambda: len(obsolete.obsstore(svfs))) |
3675 timer(lambda: len(obsolete.obsstore(svfs))) |
3672 fm.end() |
3676 fm.end() |
3673 |
3677 |
3674 |
3678 |
3675 @command( |
3679 @command( |
3676 b'perf--lrucachedict', |
3680 b'perf::lrucachedict|perflrucachedict', |
3677 formatteropts |
3681 formatteropts |
3678 + [ |
3682 + [ |
3679 (b'', b'costlimit', 0, b'maximum total cost of items in cache'), |
3683 (b'', b'costlimit', 0, b'maximum total cost of items in cache'), |
3680 (b'', b'mincost', 0, b'smallest cost of items in cache'), |
3684 (b'', b'mincost', 0, b'smallest cost of items in cache'), |
3681 (b'', b'maxcost', 100, b'maximum cost of items in cache'), |
3685 (b'', b'maxcost', 100, b'maximum cost of items in cache'), |
3827 timer(fn, title=title) |
3831 timer(fn, title=title) |
3828 fm.end() |
3832 fm.end() |
3829 |
3833 |
3830 |
3834 |
3831 @command( |
3835 @command( |
3832 b'perf--write', |
3836 b'perf::write|perfwrite', |
3833 formatteropts |
3837 formatteropts |
3834 + [ |
3838 + [ |
3835 (b'', b'write-method', b'write', b'ui write method'), |
3839 (b'', b'write-method', b'write', b'ui write method'), |
3836 (b'', b'nlines', 100, b'number of lines'), |
3840 (b'', b'nlines', 100, b'number of lines'), |
3837 (b'', b'nitems', 100, b'number of items (per line)'), |
3841 (b'', b'nitems', 100, b'number of items (per line)'), |
3890 |
3894 |
3891 extensions.wrapfunction(cmdutil, b'openrevlog', openrevlog) |
3895 extensions.wrapfunction(cmdutil, b'openrevlog', openrevlog) |
3892 |
3896 |
3893 |
3897 |
3894 @command( |
3898 @command( |
3895 b'perf--progress', |
3899 b'perf::progress|perfprogress', |
3896 formatteropts |
3900 formatteropts |
3897 + [ |
3901 + [ |
3898 (b'', b'topic', b'topic', b'topic for progress messages'), |
3902 (b'', b'topic', b'topic', b'topic for progress messages'), |
3899 (b'c', b'total', 1000000, b'total value we are progressing to'), |
3903 (b'c', b'total', 1000000, b'total value we are progressing to'), |
3900 ], |
3904 ], |