Conversation
Before
```
Evaluated relational algebra for predicate TypeMention::RefTypeReprMention.resolveRootType/0#dispred#091b949a#fb@4bd8a49g with tuple counts:
124419 ~0% {1} r1 = RefTypeRepr::Generated::RefTypeRepr#422893fa AND NOT `RefTypeRepr::Generated::RefTypeRepr.isMut/0#dispred#e2b9988f`(FIRST 1)
6621454761 ~1% {3} | JOIN WITH `Type::DataType.getTypeItem/0#dispred#83467854` CARTESIAN PRODUCT OUTPUT Rhs.0, Lhs.0, Rhs.1
915101745 ~0% {4} | JOIN WITH `project#Type::DataType.getPositionalTypeParameter/1#dispred#3bf49cbe` ON FIRST 1 OUTPUT Lhs.2, _, Lhs.1, Lhs.0
915101745 ~3% {4} | REWRITE WITH Out.1 := "Ref"
124419 ~0% {2} | JOIN WITH `Builtins::BuiltinType.getName/0#dispred#8f62ab0a` ON FIRST 2 OUTPUT Lhs.2, Lhs.3
76728 ~0% {1} r2 = JOIN RefTypeRepr::Generated::RefTypeRepr#422893fa WITH `RefTypeRepr::Generated::RefTypeRepr.isMut/0#dispred#e2b9988f` ON FIRST 1 OUTPUT Lhs.0
4083387432 ~1% {3} | JOIN WITH `Type::DataType.getTypeItem/0#dispred#83467854` CARTESIAN PRODUCT OUTPUT Rhs.0, Lhs.0, Rhs.1
564334440 ~3% {4} | JOIN WITH `project#Type::DataType.getPositionalTypeParameter/1#dispred#3bf49cbe` ON FIRST 1 OUTPUT Lhs.2, _, Lhs.1, Lhs.0
564334440 ~0% {4} | REWRITE WITH Out.1 := "RefMut"
76728 ~2% {2} | JOIN WITH `Builtins::BuiltinType.getName/0#dispred#8f62ab0a` ON FIRST 2 OUTPUT Lhs.2, Lhs.3
201147 ~1% {2} r3 = r1 UNION r2
return r3
```
After
```
Evaluated relational algebra for predicate TypeMention::RefTypeReprMention.resolveRootType/0#dispred#091b949a#fb@8f12aa2a with tuple counts:
124419 ~0% {1} r1 = RefTypeRepr::Generated::RefTypeRepr#422893fa AND NOT `RefTypeRepr::Generated::RefTypeRepr.isMut/0#dispred#e2b9988f`(FIRST 1)
124419 ~0% {2} | JOIN WITH Type::RefSharedType#090df68e CARTESIAN PRODUCT OUTPUT Rhs.0, Lhs.0
124419 ~0% {2} | JOIN WITH `project#Type::DataType.getPositionalTypeParameter/1#dispred#3bf49cbe` ON FIRST 1 OUTPUT Lhs.1, Lhs.0
76728 ~0% {1} r2 = JOIN RefTypeRepr::Generated::RefTypeRepr#422893fa WITH `RefTypeRepr::Generated::RefTypeRepr.isMut/0#dispred#e2b9988f` ON FIRST 1 OUTPUT Lhs.0
76728 ~0% {2} | JOIN WITH Type::RefMutType#c67a1837 CARTESIAN PRODUCT OUTPUT Rhs.0, Lhs.0
76728 ~2% {2} | JOIN WITH `project#Type::DataType.getPositionalTypeParameter/1#dispred#3bf49cbe` ON FIRST 1 OUTPUT Lhs.1, Lhs.0
201147 ~1% {2} r3 = r1 UNION r2
return r3
```
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes QL query performance by adding pragma[nomagic] annotations to type constructors in the Rust type inference library. The optimization prevents inefficient Cartesian product joins, reducing intermediate tuple counts from billions to thousands and improving query evaluation efficiency.
Changes:
- Added
pragma[nomagic]annotations to 7 type constructor predicates to optimize join operations
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before
After