Mark Shannon <m...@hotpy.org> added the comment:

If some misses are caused by mixed int/float operands, it might be worth 
investigating whether these occur in loops.

Most JIT compilers perform some sort of loop peeling to counter this form of 
type instability.

E.g.
x = 0
for ...
    x += some_float()

`x` is an int for the first iteration, and a float for the others.


By unpeeling the first iteration, we get type stability in the loop

x = 0
#first iteration
x += some_float()
for ... #Remaining iterations
    x += some_float()  # x is always a float here.

----------
nosy: +Mark.Shannon

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45367>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to