Patchwork [v2] mergecopies: avoid slowdown from linkrev adjustment (issue4680)

login
register
mail settings
Submitter Matt Mackall
Date May 26, 2015, 2:18 p.m.
Message ID <1da062c1f925a0330dda.1432649930@ruin.waste.org>
Download mbox | patch
Permalink /patch/9273/
State Accepted
Headers show

Comments

Matt Mackall - May 26, 2015, 2:18 p.m.
# HG changeset patch
# User Matt Mackall <mpm@selenic.com>
# Date 1432640718 18000
#      Tue May 26 06:45:18 2015 -0500
# Node ID 1da062c1f925a0330ddafe7dc4ac7a380932035c
# Parent  605b1d32c1c011d56233f28923ee5354fce7e426
mergecopies: avoid slowdown from linkrev adjustment (issue4680)

checkcopies was using fctx.rev() which it was expecting would be
equivalent to linkrev() but was triggering the new _adjustlinkrev path.
This was making grafts and merges with large sets of potential copies
very expensive.
Augie Fackler - May 26, 2015, 3:15 p.m.
On Tue, May 26, 2015 at 09:18:50AM -0500, Matt Mackall wrote:
> # HG changeset patch
> # User Matt Mackall <mpm@selenic.com>
> # Date 1432640718 18000
> #      Tue May 26 06:45:18 2015 -0500
> # Node ID 1da062c1f925a0330ddafe7dc4ac7a380932035c
> # Parent  605b1d32c1c011d56233f28923ee5354fce7e426
> mergecopies: avoid slowdown from linkrev adjustment (issue4680)

derp, I even knew this was coming but queued v1. Queued this one as a
replacement for the previous version.

>
> checkcopies was using fctx.rev() which it was expecting would be
> equivalent to linkrev() but was triggering the new _adjustlinkrev path.
> This was making grafts and merges with large sets of potential copies
> very expensive.
>
> diff -r 605b1d32c1c0 -r 1da062c1f925 mercurial/copies.py
> --- a/mercurial/copies.py	Sat May 23 15:55:04 2015 -0500
> +++ b/mercurial/copies.py	Tue May 26 06:45:18 2015 -0500
> @@ -456,7 +456,7 @@
>
>          g1, g2 = f1.ancestors(), f2.ancestors()
>          try:
> -            f1r, f2r = f1.rev(), f2.rev()
> +            f1r, f2r = f1.linkrev(), f2.linkrev()
>
>              if f1r is None:
>                  f1 = g1.next()
> @@ -464,7 +464,7 @@
>                  f2 = g2.next()
>
>              while True:
> -                f1r, f2r = f1.rev(), f2.rev()
> +                f1r, f2r = f1.linkrev(), f2.linkrev()
>                  if f1r > f2r:
>                      f1 = g1.next()
>                  elif f2r > f1r:
> @@ -479,7 +479,7 @@
>      of = None
>      seen = set([f])
>      for oc in ctx(f, m1[f]).ancestors():
> -        ocr = oc.rev()
> +        ocr = oc.linkrev()
>          of = oc.path()
>          if of in seen:
>              # check limit late - grab last rename before
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
Gregory Szorc - May 26, 2015, 4:46 p.m.
On Tue, May 26, 2015 at 8:15 AM, Augie Fackler <raf@durin42.com> wrote:

> On Tue, May 26, 2015 at 09:18:50AM -0500, Matt Mackall wrote:
> > # HG changeset patch
> > # User Matt Mackall <mpm@selenic.com>
> > # Date 1432640718 18000
> > #      Tue May 26 06:45:18 2015 -0500
> > # Node ID 1da062c1f925a0330ddafe7dc4ac7a380932035c
> > # Parent  605b1d32c1c011d56233f28923ee5354fce7e426
> > mergecopies: avoid slowdown from linkrev adjustment (issue4680)
>
> derp, I even knew this was coming but queued v1. Queued this one as a
> replacement for the previous version.
>

This should be queued for stable since it is a regression, no?


>
> >
> > checkcopies was using fctx.rev() which it was expecting would be
> > equivalent to linkrev() but was triggering the new _adjustlinkrev path.
> > This was making grafts and merges with large sets of potential copies
> > very expensive.
> >
> > diff -r 605b1d32c1c0 -r 1da062c1f925 mercurial/copies.py
> > --- a/mercurial/copies.py     Sat May 23 15:55:04 2015 -0500
> > +++ b/mercurial/copies.py     Tue May 26 06:45:18 2015 -0500
> > @@ -456,7 +456,7 @@
> >
> >          g1, g2 = f1.ancestors(), f2.ancestors()
> >          try:
> > -            f1r, f2r = f1.rev(), f2.rev()
> > +            f1r, f2r = f1.linkrev(), f2.linkrev()
> >
> >              if f1r is None:
> >                  f1 = g1.next()
> > @@ -464,7 +464,7 @@
> >                  f2 = g2.next()
> >
> >              while True:
> > -                f1r, f2r = f1.rev(), f2.rev()
> > +                f1r, f2r = f1.linkrev(), f2.linkrev()
> >                  if f1r > f2r:
> >                      f1 = g1.next()
> >                  elif f2r > f1r:
> > @@ -479,7 +479,7 @@
> >      of = None
> >      seen = set([f])
> >      for oc in ctx(f, m1[f]).ancestors():
> > -        ocr = oc.rev()
> > +        ocr = oc.linkrev()
> >          of = oc.path()
> >          if of in seen:
> >              # check limit late - grab last rename before
> > _______________________________________________
> > Mercurial-devel mailing list
> > Mercurial-devel@selenic.com
> > https://selenic.com/mailman/listinfo/mercurial-devel
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
>
Augie Fackler - May 26, 2015, 6:06 p.m.
On Tue, May 26, 2015 at 12:46 PM, Gregory Szorc <gregory.szorc@gmail.com> wrote:
> On Tue, May 26, 2015 at 8:15 AM, Augie Fackler <raf@durin42.com> wrote:
>>
>> On Tue, May 26, 2015 at 09:18:50AM -0500, Matt Mackall wrote:
>> > # HG changeset patch
>> > # User Matt Mackall <mpm@selenic.com>
>> > # Date 1432640718 18000
>> > #      Tue May 26 06:45:18 2015 -0500
>> > # Node ID 1da062c1f925a0330ddafe7dc4ac7a380932035c
>> > # Parent  605b1d32c1c011d56233f28923ee5354fce7e426
>> > mergecopies: avoid slowdown from linkrev adjustment (issue4680)
>>
>> derp, I even knew this was coming but queued v1. Queued this one as a
>> replacement for the previous version.
>
>
> This should be queued for stable since it is a regression, no?

Quite right. Fixed locally, will push soon (to crew, since clowncopter
is down I guess).

>
>>
>>
>> >
>> > checkcopies was using fctx.rev() which it was expecting would be
>> > equivalent to linkrev() but was triggering the new _adjustlinkrev path.
>> > This was making grafts and merges with large sets of potential copies
>> > very expensive.
>> >
>> > diff -r 605b1d32c1c0 -r 1da062c1f925 mercurial/copies.py
>> > --- a/mercurial/copies.py     Sat May 23 15:55:04 2015 -0500
>> > +++ b/mercurial/copies.py     Tue May 26 06:45:18 2015 -0500
>> > @@ -456,7 +456,7 @@
>> >
>> >          g1, g2 = f1.ancestors(), f2.ancestors()
>> >          try:
>> > -            f1r, f2r = f1.rev(), f2.rev()
>> > +            f1r, f2r = f1.linkrev(), f2.linkrev()
>> >
>> >              if f1r is None:
>> >                  f1 = g1.next()
>> > @@ -464,7 +464,7 @@
>> >                  f2 = g2.next()
>> >
>> >              while True:
>> > -                f1r, f2r = f1.rev(), f2.rev()
>> > +                f1r, f2r = f1.linkrev(), f2.linkrev()
>> >                  if f1r > f2r:
>> >                      f1 = g1.next()
>> >                  elif f2r > f1r:
>> > @@ -479,7 +479,7 @@
>> >      of = None
>> >      seen = set([f])
>> >      for oc in ctx(f, m1[f]).ancestors():
>> > -        ocr = oc.rev()
>> > +        ocr = oc.linkrev()
>> >          of = oc.path()
>> >          if of in seen:
>> >              # check limit late - grab last rename before
>> > _______________________________________________
>> > Mercurial-devel mailing list
>> > Mercurial-devel@selenic.com
>> > https://selenic.com/mailman/listinfo/mercurial-devel
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel@selenic.com
>> https://selenic.com/mailman/listinfo/mercurial-devel
>
>

Patch

diff -r 605b1d32c1c0 -r 1da062c1f925 mercurial/copies.py
--- a/mercurial/copies.py	Sat May 23 15:55:04 2015 -0500
+++ b/mercurial/copies.py	Tue May 26 06:45:18 2015 -0500
@@ -456,7 +456,7 @@ 
 
         g1, g2 = f1.ancestors(), f2.ancestors()
         try:
-            f1r, f2r = f1.rev(), f2.rev()
+            f1r, f2r = f1.linkrev(), f2.linkrev()
 
             if f1r is None:
                 f1 = g1.next()
@@ -464,7 +464,7 @@ 
                 f2 = g2.next()
 
             while True:
-                f1r, f2r = f1.rev(), f2.rev()
+                f1r, f2r = f1.linkrev(), f2.linkrev()
                 if f1r > f2r:
                     f1 = g1.next()
                 elif f2r > f1r:
@@ -479,7 +479,7 @@ 
     of = None
     seen = set([f])
     for oc in ctx(f, m1[f]).ancestors():
-        ocr = oc.rev()
+        ocr = oc.linkrev()
         of = oc.path()
         if of in seen:
             # check limit late - grab last rename before