I have a division operation inside a loop repeating many times. It so happened that in the first few passes through the cycle (more or less the first 10 cycles), the divisor is zero. Once it gets the value, a div error of zero is no longer possible.
I have an if condition to check the divisor value to avoid the div being zero, but I am wondering if there is a performance impact that this if evaluates for each run in subsequent cycles, especially since I know that it is useless.
How should this be encoded? in python?
performance python if-statement
greye Mar 26 '10 at 6:54 2010-03-26 06:54
source share