Patchwork [1,of,5] perf: move some of the perftags benchmark to the setup function

login
register
mail settings
Submitter Boris Feld
Date Nov. 20, 2018, 7:18 p.m.
Message ID <4ea6bac93535a7b6f69d.1542741485@localhost.localdomain>
Download mbox | patch
Permalink /patch/36673/
State Accepted
Headers show

Comments

Boris Feld - Nov. 20, 2018, 7:18 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1542708625 0
#      Tue Nov 20 10:10:25 2018 +0000
# Node ID 4ea6bac93535a7b6f69df014f738a45104bab934
# Parent  b56094b2c5263006b68997713825fa9647a7431c
# EXP-Topic perf-tags
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 4ea6bac93535
perf: move some of the perftags benchmark to the setup function

Creating fresh objects and clearing the cache should not be part of the
timing.

before: ! wall 0.020851 comb 0.020000 user 0.020000 sys 0.000000 (median of 138)
after:  ! wall 0.018740 comb 0.020000 user 0.020000 sys 0.000000 (median of 141)
Pulkit Goyal - Nov. 22, 2018, 9:30 a.m.
On Tue, Nov 20, 2018 at 10:21 PM Boris Feld <boris.feld@octobus.net> wrote:

> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1542708625 0
> #      Tue Nov 20 10:10:25 2018 +0000
> # Node ID 4ea6bac93535a7b6f69df014f738a45104bab934
> # Parent  b56094b2c5263006b68997713825fa9647a7431c
> # EXP-Topic perf-tags
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
> 4ea6bac93535
> perf: move some of the perftags benchmark to the setup function
>
> Creating fresh objects and clearing the cache should not be part of the
> timing.
>
> before: ! wall 0.020851 comb 0.020000 user 0.020000 sys 0.000000 (median
> of 138)
> after:  ! wall 0.018740 comb 0.020000 user 0.020000 sys 0.000000 (median
> of 141)
>

Queued only this one, many thanks!

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -539,14 +539,15 @@  def perftags(ui, repo, **opts):
     timer, fm = gettimer(ui, opts)
     svfs = getsvfs(repo)
     repocleartagscache = repocleartagscachefunc(repo)
-    def t():
+    def s():
         repo.changelog = mercurial.changelog.changelog(svfs)
         rootmanifest = mercurial.manifest.manifestrevlog(svfs)
         repo.manifestlog = mercurial.manifest.manifestlog(svfs, repo,
                                                           rootmanifest)
         repocleartagscache()
+    def t():
         return len(repo.tags())
-    timer(t)
+    timer(t, setup=s)
     fm.end()
 
 @command(b'perfancestors', formatteropts)