Mercurial > hg-stable
comparison contrib/perf.py @ 40720:c0a1686d9391
perf: use the new setup function in "perfbookmarks"
This command was picked arbitrarily to display the usefulness of the new
feature. In my Mercurial repository (with very few bookmarks), moving cache
cleanup in the dedicated setup function has a visible and stable effect on
the benchmark number.
before: ! wall 0.000061 comb 0.000000 user 0.000000 sys 0.000000 (median of 40837)
after: ! wall 0.000058 comb 0.000000 user 0.000000 sys 0.000000 (median of 40500)
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 19 Nov 2018 23:14:46 +0000 |
parents | 9d88ae5c635b |
children | 4369c00a8ee1 |
comparison
equal
deleted
inserted
replaced
40719:9d88ae5c635b | 40720:c0a1686d9391 |
---|---|
574 @command(b'perfbookmarks', formatteropts) | 574 @command(b'perfbookmarks', formatteropts) |
575 def perfbookmarks(ui, repo, **opts): | 575 def perfbookmarks(ui, repo, **opts): |
576 """benchmark parsing bookmarks from disk to memory""" | 576 """benchmark parsing bookmarks from disk to memory""" |
577 opts = _byteskwargs(opts) | 577 opts = _byteskwargs(opts) |
578 timer, fm = gettimer(ui, opts) | 578 timer, fm = gettimer(ui, opts) |
579 def d(): | 579 |
580 def s(): | |
580 clearfilecache(repo, b'_bookmarks') | 581 clearfilecache(repo, b'_bookmarks') |
582 def d(): | |
581 repo._bookmarks | 583 repo._bookmarks |
582 timer(d) | 584 timer(d, setup=s) |
583 fm.end() | 585 fm.end() |
584 | 586 |
585 @command(b'perfbundleread', formatteropts, b'BUNDLE') | 587 @command(b'perfbundleread', formatteropts, b'BUNDLE') |
586 def perfbundleread(ui, repo, bundlepath, **opts): | 588 def perfbundleread(ui, repo, bundlepath, **opts): |
587 """Benchmark reading of bundle files. | 589 """Benchmark reading of bundle files. |