Skip to content

Python: Disallow PostUpdateNode as LocalSourceNode #5690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

tausbn
Copy link
Contributor

@tausbn tausbn commented Apr 15, 2021

Previously, in cases like

def foo(x):
    x.bar()
    x.baz()
    x.quux()

we would have flow from the first x to each use and flow from the
post-update node for each method call to each subsequent use, and all
of these would be LocalSourceNodes. For large functions with the above
pattern, this would lead to a quadratic blowup in hasLocalSource.

With this commit, only the first of these will count as a
LocalSourceNode, and the blowup disappears.


Evaluation needed. I don't think a change note is necessary (but I'm willing to be convinced otherwise).

Previously, in cases like

```python
def foo(x):
    x.bar()
    x.baz()
    x.quux()
```

we would have flow from the first `x` to each use _and_ flow from the
post-update node for each method call to each subsequent use, and all
of these would be `LocalSourceNode`s. For large functions with the above
pattern, this would lead to a quadratic blowup in `hasLocalSource`.

With this commit, only the first of these will count as a
`LocalSourceNode`, and the blowup disappears.
@tausbn tausbn added Awaiting evaluation Do not merge yet, this PR is waiting for an evaluation to finish no-change-note-required This PR does not need a change note labels Apr 15, 2021
@tausbn tausbn requested a review from a team as a code owner April 15, 2021 18:01
@tausbn
Copy link
Contributor Author

tausbn commented Apr 15, 2021

Hmm... Test failures seem to indicate that having PostUpdateNodes as source nodes is important somehow. I'll convert to draft while I investigate.

@tausbn tausbn marked this pull request as draft April 15, 2021 18:30
Specifically, allow the ones arising from calls, but not reads or
writes. This should fix the tests.
@tausbn tausbn marked this pull request as ready for review April 15, 2021 21:52
@tausbn
Copy link
Contributor Author

tausbn commented Apr 16, 2021

Performance: https://github.com/dsp-testing/tausbn-dca/issues/13
Seems to only affect pathological cases (but there it can make a big difference).

@tausbn tausbn removed the Awaiting evaluation Do not merge yet, this PR is waiting for an evaluation to finish label Apr 16, 2021
Goes into some detail about the intended semantics of local source nodes
and `flowsTo`.
@tausbn tausbn added the Awaiting evaluation Do not merge yet, this PR is waiting for an evaluation to finish label Apr 16, 2021
@tausbn
Copy link
Contributor Author

tausbn commented Apr 16, 2021

As the behaviour has now changed since the last performance test, I'm running another one.

Copy link
Contributor

@yoff yoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great comments! Happy to merge this once the performance has been verified :-)

@tausbn
Copy link
Contributor Author

tausbn commented Apr 16, 2021

Evaluation (still) running here: https://github.com/dsp-testing/tausbn-dca/issues/14

Copy link
Contributor

@yoff yoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Evaluations look great :-)

@yoff yoff merged commit 118840d into github:main Apr 19, 2021
@tausbn tausbn removed the Awaiting evaluation Do not merge yet, this PR is waiting for an evaluation to finish label Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-change-note-required This PR does not need a change note Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants