Skip to content

Conversation

@hvitved
Copy link
Contributor

@hvitved hvitved commented Aug 4, 2025

Evaluated relational algebra for predicate _Crate::Crate.getSourceFile/0#dispred#e7adf9d7_Crate::Generated::Crate.getName/0#dispred#f4d3b3bf_Pa__#join_rhs@5a04a7t0 with tuple counts:
        34471980   ~0%    {3} r1 = JOIN `PathResolution::isSourceFile/1#803de032` WITH `Crate::Crate.getSourceFile/0#dispred#e7adf9d7` CARTESIAN PRODUCT OUTPUT Rhs.0, Lhs.0, Rhs.1
        34471980  ~37%    {4}    | JOIN WITH `Crate::Generated::Crate.getName/0#dispred#f4d3b3bf` ON FIRST 1 OUTPUT Lhs.1, Lhs.2, Rhs.1, _
                          {3}    | REWRITE WITH NOT [Tmp.3 := "std", TEST InOut.2 != Tmp.3, Tmp.3 := "core", TEST InOut.2 != Tmp.3] KEEPING 3
           93420  ~91%    {3}    | SCAN OUTPUT In.1, _, In.0
           93420  ~87%    {3}    | REWRITE WITH Out.1 := "prelude"
                          return r1

```
Evaluated relational algebra for predicate _Crate::Crate.getSourceFile/0#dispred#e7adf9d7_Crate::Generated::Crate.getName/0#dispred#f4d3b3bf_Pa__#join_rhs@5a04a7t0 with tuple counts:
        34471980   ~0%    {3} r1 = JOIN `PathResolution::isSourceFile/1#803de032` WITH `Crate::Crate.getSourceFile/0#dispred#e7adf9d7` CARTESIAN PRODUCT OUTPUT Rhs.0, Lhs.0, Rhs.1
        34471980  ~37%    {4}    | JOIN WITH `Crate::Generated::Crate.getName/0#dispred#f4d3b3bf` ON FIRST 1 OUTPUT Lhs.1, Lhs.2, Rhs.1, _
                          {3}    | REWRITE WITH NOT [Tmp.3 := "std", TEST InOut.2 != Tmp.3, Tmp.3 := "core", TEST InOut.2 != Tmp.3] KEEPING 3
           93420  ~91%    {3}    | SCAN OUTPUT In.1, _, In.0
           93420  ~87%    {3}    | REWRITE WITH Out.1 := "prelude"
                          return r1
```
@github-actions github-actions bot added the Rust Pull requests that update Rust code label Aug 4, 2025
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Aug 4, 2025
@hvitved hvitved marked this pull request as ready for review August 4, 2025 18:16
@hvitved hvitved requested a review from a team as a code owner August 4, 2025 18:16
Copilot AI review requested due to automatic review settings August 4, 2025 18:16
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

This PR optimizes a performance bottleneck in the Rust query language code by refactoring duplicate predicate logic to improve join efficiency. The change addresses a bad join pattern that was causing excessive tuple counts during query evaluation.

  • Extracted shared logic for finding prelude items into a separate predicate
  • Reordered join conditions in preludeEdge to optimize query performance

Copy link
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for fixing.

@hvitved hvitved merged commit b426d84 into github:main Aug 5, 2025
21 checks passed
@hvitved hvitved deleted the rust/fix-bad-join branch August 5, 2025 07:55
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 Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants