mypy icon indicating copy to clipboard operation
mypy copied to clipboard

[mypyc] Generate faster code for bool comparisons and arithmetic

Open JukkaL opened this issue 3 years ago • 0 comments

Generate specialized, efficient IR for various operations on bools. These are covered:

  • Bool comparisons
  • Mixed bool/integer comparisons
  • Bool arithmetic (binary and unary)
  • Mixed bool/integer arithmetic and bitwise ops

Mixed operations where the left operand is a bool and the right operand is a native int still have some unnecessary conversions between native int and int. This would be a bit trickier to fix and is seems rare, so it doesn't seem urgent to fix this.

Fixes mypyc/mypyc#968.

JukkaL avatar Jan 21 '23 13:01 JukkaL