Take the code
"""
def add(a, b):
c = a + b
d = a + b
return c + d
def main():
for _ in xrange(12000):
add(1, 1)
"""
that is, we forcibly specialize add() on ints. We currently do six
typechecks in that function to make sure a, b, c and d are all ints. a and b
are checked twice each, once per addition, even though they could not
possibly have changed types between those two statements.
High priority:
- Eliminate the second pair of typechecks for a and b (the ones on "d = a +
b"); the type information from "c = a + b" should propagate.
Lower priority:
- Eliminate the typechecks in "c + d".
- Eliminate "d = a + b" statement in favor of "d = c".
Original issue reported on code.google.com by collinw on 28 Jan 2010 at 10:15
Original issue reported on code.google.com by
collinw
on 28 Jan 2010 at 10:15