Debugging performance regressions?

Any tips on how to debug performance regressions?

And as aside, if this test is critical enough to cause a revert, why isn’t it in the public repo?

···

On Aug 9, 2017, at 14:04, Arnold Schwaighofer <notifications@github.com> wrote:

Hi Dave,
I have reverted this commit because it broke internal bots.

import Foundation
class P {
    var x : Int = 0
    var y : Int = 1
}

let dist : (P, P) -> Double = {
  (p : P, s : P) -> Double in
    sqrt(Double((p.x-s.x)*(p.x-s.x) + (p.y-s.y)*(p.y-s.y)))
}
fails now with expression to complex.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <Simplify performMemberLookup() by davezarzycki · Pull Request #11397 · apple/swift · GitHub, or mute the thread <Sign in to GitHub · GitHub.

Mark do you have suggestions for Dave?

Any tips on how to debug performance regressions?

And as aside, if this test is critical enough to cause a revert, why isn’t it in the public repo?

This is part of a larger internal test.

···

On Aug 9, 2017, at 11:22 AM, David Zarzycki via swift-dev <swift-dev@swift.org> wrote:

On Aug 9, 2017, at 14:04, Arnold Schwaighofer <notifications@github.com <mailto:notifications@github.com>> wrote:

Hi Dave,
I have reverted this commit because it broke internal bots.

import Foundation
class P {
    var x : Int = 0
    var y : Int = 1
}

let dist : (P, P) -> Double = {
  (p : P, s : P) -> Double in
    sqrt(Double((p.x-s.x)*(p.x-s.x) + (p.y-s.y)*(p.y-s.y)))
}
fails now with expression to complex.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <Simplify performMemberLookup() by davezarzycki · Pull Request #11397 · apple/swift · GitHub, or mute the thread <Sign in to GitHub · GitHub.

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

Hi David,

   What I usually do is - lldb with debug build, or debug build REPL with
":constraints debug on" which is going to print what type checker is doing
   and attach using lldb or Xcode.

   This example definitely belongs in the repo, I will add it right away.

Best Regards, Pavel.

···

On Wed, Aug 9, 2017 at 11:22 AM, David Zarzycki via swift-dev < swift-dev@swift.org> wrote:

Any tips on how to debug performance regressions?

And as aside, if this test is critical enough to cause a revert, why isn’t
it in the public repo?

On Aug 9, 2017, at 14:04, Arnold Schwaighofer <notifications@github.com> > wrote:

Hi Dave,
I have reverted this commit because it broke internal bots.

import Foundation
class P {
    var x : Int = 0
    var y : Int = 1
}

let dist : (P, P) -> Double = {
  (p : P, s : P) -> Double in
    sqrt(Double((p.x-s.x)*(p.x-s.x) + (p.y-s.y)*(p.y-s.y)))
}

fails now with expression to complex.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<Simplify performMemberLookup() by davezarzycki · Pull Request #11397 · apple/swift · GitHub, or mute
the thread
<Sign in to GitHub · GitHub;
.

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

Mark do you have suggestions for Dave?

Also, whatever comes from this, can we document in updating the compiler.

···

On Aug 9, 2017, at 11:34 AM, Arnold Schwaighofer via swift-dev <swift-dev@swift.org> wrote:

On Aug 9, 2017, at 11:22 AM, David Zarzycki via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:

Any tips on how to debug performance regressions?

And as aside, if this test is critical enough to cause a revert, why isn’t it in the public repo?

This is part of a larger internal test.

On Aug 9, 2017, at 14:04, Arnold Schwaighofer <notifications@github.com <mailto:notifications@github.com>> wrote:

Hi Dave,
I have reverted this commit because it broke internal bots.

import Foundation
class P {
    var x : Int = 0
    var y : Int = 1
}

let dist : (P, P) -> Double = {
  (p : P, s : P) -> Double in
    sqrt(Double((p.x-s.x)*(p.x-s.x) + (p.y-s.y)*(p.y-s.y)))
}
fails now with expression to complex.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <Simplify performMemberLookup() by davezarzycki · Pull Request #11397 · apple/swift · GitHub, or mute the thread <Sign in to GitHub · GitHub.

_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev

_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev

Mark do you have suggestions for Dave?

I’d suggest something similar to what Pavel said. My usual first step is to look at the output of -Xfrontend -debug-constraints, which in cases like this tends to be so verbose that you have to kill the compile after a little while and a few megabytes of output and start reviewing that output. Key things to look for are “(assuming”, which is printed for each disjunction choice, and “(trying” which is printed before each attempt at trying a type binding.

I took a quick look at this and based on the before/after output it looks like perhaps an optimization that picks favored overloads is no longer firing after your PR. As a result, rather than trying and successfully solving using integer operations for the arithmetic and stopping there, we exponentially attempt all combinations of all overloads of those operators. It would be very interesting to understand why that is since based on the description I would not expect your PR to have an impact on that.

Mark

···

On Aug 9, 2017, at 11:33 AM, Arnold Schwaighofer <aschwaighofer@apple.com> wrote:

On Aug 9, 2017, at 11:22 AM, David Zarzycki via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:

Any tips on how to debug performance regressions?

And as aside, if this test is critical enough to cause a revert, why isn’t it in the public repo?

This is part of a larger internal test.

On Aug 9, 2017, at 14:04, Arnold Schwaighofer <notifications@github.com <mailto:notifications@github.com>> wrote:

Hi Dave,
I have reverted this commit because it broke internal bots.

import Foundation
class P {
    var x : Int = 0
    var y : Int = 1
}

let dist : (P, P) -> Double = {
  (p : P, s : P) -> Double in
    sqrt(Double((p.x-s.x)*(p.x-s.x) + (p.y-s.y)*(p.y-s.y)))
}
fails now with expression to complex.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <Simplify performMemberLookup() by davezarzycki · Pull Request #11397 · apple/swift · GitHub, or mute the thread <Sign in to GitHub · GitHub.

_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev

I think that my change exposed a latent performance bug in the constraint solver. Let’s followup in a bug report:

···

On Aug 9, 2017, at 16:47, Mark Lacey <mark.lacey@apple.com> wrote:

On Aug 9, 2017, at 11:33 AM, Arnold Schwaighofer <aschwaighofer@apple.com <mailto:aschwaighofer@apple.com>> wrote:

Mark do you have suggestions for Dave?

I’d suggest something similar to what Pavel said. My usual first step is to look at the output of -Xfrontend -debug-constraints, which in cases like this tends to be so verbose that you have to kill the compile after a little while and a few megabytes of output and start reviewing that output. Key things to look for are “(assuming”, which is printed for each disjunction choice, and “(trying” which is printed before each attempt at trying a type binding.

I took a quick look at this and based on the before/after output it looks like perhaps an optimization that picks favored overloads is no longer firing after your PR. As a result, rather than trying and successfully solving using integer operations for the arithmetic and stopping there, we exponentially attempt all combinations of all overloads of those operators. It would be very interesting to understand why that is since based on the description I would not expect your PR to have an impact on that.

Mark

On Aug 9, 2017, at 11:22 AM, David Zarzycki via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:

Any tips on how to debug performance regressions?

And as aside, if this test is critical enough to cause a revert, why isn’t it in the public repo?

This is part of a larger internal test.

On Aug 9, 2017, at 14:04, Arnold Schwaighofer <notifications@github.com <mailto:notifications@github.com>> wrote:

Hi Dave,
I have reverted this commit because it broke internal bots.

import Foundation
class P {
    var x : Int = 0
    var y : Int = 1
}

let dist : (P, P) -> Double = {
  (p : P, s : P) -> Double in
    sqrt(Double((p.x-s.x)*(p.x-s.x) + (p.y-s.y)*(p.y-s.y)))
}
fails now with expression to complex.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <Simplify performMemberLookup() by davezarzycki · Pull Request #11397 · apple/swift · GitHub, or mute the thread <Sign in to GitHub · GitHub.

_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev