-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Rust: Fix bad join #21180
Conversation
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)
There was a problem hiding this 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
lto storen.getLocation()in theisFromMacroExpansionpredicate, preventing an expensive join operation
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Before
(No After; the predicate is no longer generated)