Patchwork [evolve-ext] inhibit: improve performance of transaction wrapping

login
register
mail settings
Submitter Laurent Charignon
Date June 15, 2015, 4:13 p.m.
Message ID <8bc89f9453a9ad2f6619.1434384801@dev919.prn2.facebook.com>
Download mbox | patch
Permalink /patch/9634/
State Accepted
Headers show

Comments

Laurent Charignon - June 15, 2015, 4:13 p.m.
# HG changeset patch
# User Laurent Charignon <lcharignon@fb.com>
# Date 1434219267 25200
#      Sat Jun 13 11:14:27 2015 -0700
# Node ID 8bc89f9453a9ad2f66197955ff5aafb8d9ba69ea
# Parent  043e5ca9322fc92cd90b9ff3dc462bcbfbd3c095
inhibit: improve performance of transaction wrapping

Before this patch, transaction wrapping was the most expensive part of inhibit
computation wise. This patch changes the revset that we use in the transaction
wrapping to make it ~18x faster to compute:

revset #0: (not public()) and (not hidden()) and obsolete()
0) wall 0.000609 comb 0.000000 user 0.000000 sys 0.000000 (best of 4170)

vs

revset #0: (not hidden()) and obsolete()
0) wall 0.010965 comb 0.010000 user 0.010000 sys 0.000000 (best of 237)

To do this test I imported Pierre-Yves' change to makes sure that we use
native phase computation.
Pierre-Yves David - June 15, 2015, 4:20 p.m.
On 06/15/2015 09:13 AM, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon@fb.com>
> # Date 1434219267 25200
> #      Sat Jun 13 11:14:27 2015 -0700
> # Node ID 8bc89f9453a9ad2f66197955ff5aafb8d9ba69ea
> # Parent  043e5ca9322fc92cd90b9ff3dc462bcbfbd3c095
> inhibit: improve performance of transaction wrapping
>
> Before this patch, transaction wrapping was the most expensive part of inhibit
> computation wise. This patch changes the revset that we use in the transaction
> wrapping to make it ~18x faster to compute:
>
> revset #0: (not public()) and (not hidden()) and obsolete()
> 0) wall 0.000609 comb 0.000000 user 0.000000 sys 0.000000 (best of 4170)
>
> vs
>
> revset #0: (not hidden()) and obsolete()
> 0) wall 0.010965 comb 0.010000 user 0.010000 sys 0.000000 (best of 237)

Try using 'obsolete() - hidden()', I expect it to be even faster.
(If the optimisateur could see and apply that, that would be great, but 
this is another adventure)

Patch

diff --git a/hgext/inhibit.py b/hgext/inhibit.py
--- a/hgext/inhibit.py
+++ b/hgext/inhibit.py
@@ -172,7 +172,7 @@ 
     def inhibitposttransaction(transaction):
         # At the end of the transaction we catch all the new visible and
         # obsolete commit to inhibit them
-        visibleobsolete = repo.revs('(not hidden()) and obsolete()')
+        visibleobsolete = repo.revs('(not public()) and (not hidden()) and obsolete()')
         ignoreset = set(getattr(repo, '_rebaseset', []))
         visibleobsolete = list(r for r in visibleobsolete if r not in ignoreset)
         if visibleobsolete: