Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Rust: Fix bad join #21180

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

Open
hvitved wants to merge 1 commit into github:main
base: main
Choose a base branch
Loading
from hvitved:rust/fix-bad-join2
Open

Rust: Fix bad join #21180

hvitved wants to merge 1 commit into github:main from hvitved:rust/fix-bad-join2

Conversation

@hvitved
Copy link
Contributor

@hvitved hvitved commented Jan 16, 2026

Before

Evaluated relational algebra for predicate _ElementImpl::Impl::MacroExpansion::isAttributeMacroExpansionSourceLocation/2#3429148c_Locatable::Lo__#antijoin_rhs@9f4aa4rk with tuple counts:
 5127263380 ~4% {3} r1 = JOIN `_AstNodeImpl::Impl::AstNode#22e758cf_ElementImpl::Impl::MacroExpansion::getATokenTreeNode/1#a2df59a3__#shared` WITH `ElementImpl::Impl::MacroExpansion::isAttributeMacroExpansionSourceLocation/2#3429148c` ON FIRST 1 OUTPUT Lhs.1, Rhs.1, Lhs.0
 305226 ~0% {2} | JOIN WITH `Locatable::Locatable.getLocation/0#dispred#f3f7e2b2` ON FIRST 2 OUTPUT Lhs.0, Lhs.2
 return r1

(No After; the predicate is no longer generated)

Before
```
Evaluated relational algebra for predicate _ElementImpl::Impl::MacroExpansion::isAttributeMacroExpansionSourceLocation/2#3429148c_Locatable::Lo__#antijoin_rhs@9f4aa4rk with tuple counts:
 5127263380 ~4% {3} r1 = JOIN `_AstNodeImpl::Impl::AstNode#22e758cf_ElementImpl::Impl::MacroExpansion::getATokenTreeNode/1#a2df59a3__#shared` WITH `ElementImpl::Impl::MacroExpansion::isAttributeMacroExpansionSourceLocation/2#3429148c` ON FIRST 1 OUTPUT Lhs.1, Rhs.1, Lhs.0
 305226 ~0% {2} | JOIN WITH `Locatable::Locatable.getLocation/0#dispred#f3f7e2b2` ON FIRST 2 OUTPUT Lhs.0, Lhs.2
 return r1
```
(No After; the predicate is no longer generated)
@github-actions github-actions bot added the Rust Pull requests that update Rust code label Jan 16, 2026
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Jan 16, 2026
@hvitved hvitved marked this pull request as ready for review January 16, 2026 16:19
@hvitved hvitved requested a review from a team as a code owner January 16, 2026 16:19
Copilot AI review requested due to automatic review settings January 16, 2026 16:19
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 CodeQL query in the Rust library by fixing a performance issue caused by an inefficient join operation. The change introduces an intermediate variable to store the location before using it in a negative condition, significantly reducing tuple processing from ~5 billion to eliminating the problematic predicate entirely.

Changes:

  • Introduced an intermediate variable l to store n.getLocation() in the isFromMacroExpansion predicate, preventing an expensive join operation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot Copilot left review comments

@paldepind paldepind paldepind approved these changes

Assignees

No one assigned

Labels

no-change-note-required This PR does not need a change note Rust Pull requests that update Rust code

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /