Mercurial > hg
comparison contrib/perf.py @ 27305:5831cfbf0e33
perf: perfparents honor config perf.parentscount
author | timeless <timeless@mozdev.org> |
---|---|
date | Fri, 04 Dec 2015 18:18:07 +0000 |
parents | a6fd79495770 |
children | bafb1235f505 |
comparison
equal
deleted
inserted
replaced
27304:a6fd79495770 | 27305:5831cfbf0e33 |
---|---|
306 fm.end() | 306 fm.end() |
307 | 307 |
308 @command('perfparents', formatteropts) | 308 @command('perfparents', formatteropts) |
309 def perfparents(ui, repo, **opts): | 309 def perfparents(ui, repo, **opts): |
310 timer, fm = gettimer(ui, opts) | 310 timer, fm = gettimer(ui, opts) |
311 if len(repo.changelog) < 1000: | 311 # control the number of commits perfparents iterates over |
312 raise error.Abort("repo needs 1000 commits for this test") | 312 # experimental config: perf.parentscount |
313 count = ui.configint("perf", "parentscount", 1000) | |
314 if len(repo.changelog) < count: | |
315 raise error.Abort("repo needs %d commits for this test" % count) | |
313 repo = repo.unfiltered() | 316 repo = repo.unfiltered() |
314 nl = [repo.changelog.node(i) for i in xrange(1000)] | 317 nl = [repo.changelog.node(i) for i in xrange(count)] |
315 def d(): | 318 def d(): |
316 for n in nl: | 319 for n in nl: |
317 repo.changelog.parents(n) | 320 repo.changelog.parents(n) |
318 timer(d) | 321 timer(d) |
319 fm.end() | 322 fm.end() |