##// END OF EJS Templates
perf: add a command to benchmark linelog edits...
Jun Wu -
r39005:1601afbb default
parent child Browse files
Show More
@@ -889,6 +889,38 b' def perflookup(ui, repo, rev, **opts):'
889 timer(lambda: len(repo.lookup(rev)))
889 timer(lambda: len(repo.lookup(rev)))
890 fm.end()
890 fm.end()
891
891
892 @command('perflinelogedits',
893 [('n', 'edits', 10000, 'number of edits'),
894 ('', 'max-hunk-lines', 10, 'max lines in a hunk'),
895 ], norepo=True)
896 def perflinelogedits(ui, **opts):
897 from mercurial import linelog
898
899 edits = opts['edits']
900 maxhunklines = opts['max_hunk_lines']
901
902 maxb1 = 100000
903 random.seed(0)
904 randint = random.randint
905 currentlines = 0
906 arglist = []
907 for rev in xrange(edits):
908 a1 = randint(0, currentlines)
909 a2 = randint(a1, min(currentlines, a1 + maxhunklines))
910 b1 = randint(0, maxb1)
911 b2 = randint(b1, b1 + maxhunklines)
912 currentlines += (b2 - b1) - (a2 - a1)
913 arglist.append((rev, a1, a2, b1, b2))
914
915 def d():
916 ll = linelog.linelog()
917 for args in arglist:
918 ll.replacelines(*args)
919
920 timer, fm = gettimer(ui, opts)
921 timer(d)
922 fm.end()
923
892 @command('perfrevrange', formatteropts)
924 @command('perfrevrange', formatteropts)
893 def perfrevrange(ui, repo, *specs, **opts):
925 def perfrevrange(ui, repo, *specs, **opts):
894 timer, fm = gettimer(ui, opts)
926 timer, fm = gettimer(ui, opts)
@@ -82,6 +82,8 b' perfstatus'
82 (no help text available)
82 (no help text available)
83 perfheads (no help text available)
83 perfheads (no help text available)
84 perfindex (no help text available)
84 perfindex (no help text available)
85 perflinelogedits
86 (no help text available)
85 perfloadmarkers
87 perfloadmarkers
86 benchmark the time to parse the on-disk markers for a repo
88 benchmark the time to parse the on-disk markers for a repo
87 perflog (no help text available)
89 perflog (no help text available)
@@ -154,6 +156,7 b' perfstatus'
154 #endif
156 #endif
155 $ hg perfheads
157 $ hg perfheads
156 $ hg perfindex
158 $ hg perfindex
159 $ hg perflinelogedits -n 1
157 $ hg perfloadmarkers
160 $ hg perfloadmarkers
158 $ hg perflog
161 $ hg perflog
159 $ hg perflookup 2
162 $ hg perflookup 2
General Comments 0
You need to be logged in to leave comments. Login now