461 |
461 |
462 timer(d) |
462 timer(d) |
463 fm.end() |
463 fm.end() |
464 |
464 |
465 @command('perfrevset', |
465 @command('perfrevset', |
466 [('C', 'clear', False, 'clear volatile cache between each call.')] |
466 [('C', 'clear', False, 'clear volatile cache between each call.'), |
|
467 ('', 'contexts', False, 'obtain changectx for each revision')] |
467 + formatteropts, "REVSET") |
468 + formatteropts, "REVSET") |
468 def perfrevset(ui, repo, expr, clear=False, **opts): |
469 def perfrevset(ui, repo, expr, clear=False, contexts=False, **opts): |
469 """benchmark the execution time of a revset |
470 """benchmark the execution time of a revset |
470 |
471 |
471 Use the --clean option if need to evaluate the impact of build volatile |
472 Use the --clean option if need to evaluate the impact of build volatile |
472 revisions set cache on the revset execution. Volatile cache hold filtered |
473 revisions set cache on the revset execution. Volatile cache hold filtered |
473 and obsolete related cache.""" |
474 and obsolete related cache.""" |
474 timer, fm = gettimer(ui, opts) |
475 timer, fm = gettimer(ui, opts) |
475 def d(): |
476 def d(): |
476 if clear: |
477 if clear: |
477 repo.invalidatevolatilesets() |
478 repo.invalidatevolatilesets() |
478 for r in repo.revs(expr): pass |
479 if contexts: |
|
480 for ctx in repo.set(expr): pass |
|
481 else: |
|
482 for r in repo.revs(expr): pass |
479 timer(d) |
483 timer(d) |
480 fm.end() |
484 fm.end() |
481 |
485 |
482 @command('perfvolatilesets', formatteropts) |
486 @command('perfvolatilesets', formatteropts) |
483 def perfvolatilesets(ui, repo, *names, **opts): |
487 def perfvolatilesets(ui, repo, *names, **opts): |