changeset 5679:843e1df7912f

head-checking: micro-optimize _filter_obsolete_heads We move the branch name retrieval after the early continue: it was not needed before. On my PyPy clone, this saves about 1.4ms in the time to run _filter_obsolete_heads() for the branchmap entries of the default branch. PyPy having lots of closed branches, for the complete analysis that Heptapod currently performs on each push for PyPy, this gains around 100ms (2.5% for a total time around 4s). All those figures on my workstation.
author Georges Racinet <georges.racinet@octobus.net>
date Tue, 01 Dec 2020 21:05:53 +0100
parents aa905c52ede5
children 18a70ae9fb0b
files hgext3rd/evolve/headchecking.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/headchecking.py	Sun Dec 13 09:46:16 2020 -0800
+++ b/hgext3rd/evolve/headchecking.py	Tue Dec 01 21:05:53 2020 +0100
@@ -140,12 +140,14 @@
     while old_heads:
         rh = old_heads.pop()
         ctx = repo[rh]
-        current_name = _get_branch_name(ctx)
+
         # run this check early to skip the evaluation of the whole branch
         if not ctx.obsolete():
             new_heads.append(rh)
             continue
 
+        current_name = _get_branch_name(ctx)
+
         # Get all revs/nodes on the branch exclusive to this head
         # (already filtered heads are "ignored"))
         sections_revs = repo.revs(