Skip to content

Python: Fix bad join in method call order computation#21429

Merged
tausbn merged 1 commit intomainfrom
tausbn/fix-bad-join-in-method-call-order
Mar 10, 2026
Merged

Python: Fix bad join in method call order computation#21429
tausbn merged 1 commit intomainfrom
tausbn/fix-bad-join-in-method-call-order

Conversation

@tausbn
Copy link
Contributor

@tausbn tausbn commented Mar 9, 2026

This join had badness 1127 on the project FiacreT/M-moire, producing ~31 million tuples in order to end up with only ~27k tuples later in the pipeline. With the fix, we reduce this by roughly the full 31 million (the new materialised helper predicate accounting for roughly 130k tuples on its own).

This join had badness 1127 on the project FiacreT/M-moire, producing ~31
million tuples in order to end up with only ~27k tuples later in the
pipeline. With the fix, we reduce this by roughly the full 31 million
(the new materialised helper predicate accounting for roughly 130k
tuples on its own).

Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
@tausbn tausbn added the no-change-note-required This PR does not need a change note label Mar 9, 2026
@github-actions github-actions bot added the Python label Mar 9, 2026
Copy link
Contributor

@owen-mc owen-mc left a comment

Choose a reason for hiding this comment

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

Seems to preserve the functionality.

@tausbn tausbn marked this pull request as ready for review March 10, 2026 17:17
@tausbn tausbn requested a review from a team as a code owner March 10, 2026 17:17
Copilot AI review requested due to automatic review settings March 10, 2026 17:17
@tausbn tausbn merged commit 5a65282 into main Mar 10, 2026
24 checks passed
@tausbn tausbn deleted the tausbn/fix-bad-join-in-method-call-order branch March 10, 2026 17:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves performance of the Python QL “method call order” computation by factoring out a costly superclass-check into a dedicated helper predicate, reducing an expensive join that was producing a large number of intermediate tuples.

Changes:

  • Replaces an inline exists(Class superBase | ...) check with a new helper predicate to avoid an inefficient join pattern.
  • Adds a pragma[nomagic] private predicate to encapsulate the “superclass also missing call” condition.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +164 to +166
* Holds if a strict superclass of `base` is also missing a call to `shouldCall` named `name`,
* indicating that `base` is not the highest class in the hierarchy with this issue.
*/
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

The new doc comment is a bit ambiguous: “missing a call to shouldCall named name” reads like shouldCall is being named here. Consider rephrasing to explicitly say this checks whether any strict superclass of base also satisfies missingCallToSuperclassMethod(..., shouldCall, name) (i.e., is also missing the call to the superclass method name).

Suggested change
* Holds if a strict superclass of `base` is also missing a call to `shouldCall` named `name`,
* indicating that `base` is not the highest class in the hierarchy with this issue.
*/
* Holds if some strict superclass of `base` also satisfies `missingCallToSuperclassMethod(..., shouldCall, name)`,
* that is, is also missing the call to the superclass method named `name`, so `base` is not the highest class
* in the hierarchy with this issue.

Copilot uses AI. Check for mistakes.
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.

3 participants