Skip to content
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

[mypyc] Fast tuple equality checks #9343

Merged
merged 12 commits into from
Aug 27, 2020
Prev Previous commit
Next Next commit
specialize empty tuples
  • Loading branch information
TH3CHARLie committed Aug 25, 2020
commit 1f859da4fd4783350eb01c046e43d6edbc1418d0
4 changes: 2 additions & 2 deletions mypyc/irbuild/ll_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,8 @@ def compare_tuples(self,
equal = True if op == '==' else False
result = self.alloc_temp(bool_rprimitive)
# empty tuples
if (equal and len(lhs.type.types) == 0 and len(rhs.type.types) == 0):
self.add(Assign(result, self.true(), line))
if len(lhs.type.types) == 0 and len(rhs.type.types) == 0:
self.add(Assign(result, self.true() if equal else self.false(), line))
return result
length = len(lhs.type.types)
false_assign, true_assign, out = BasicBlock(), BasicBlock(), BasicBlock()
Expand Down