On 2012-09-07, Steven D'Aprano <[email protected]> wrote:
> My *guess* is that you mean *bitwise* operators, compared to numeric
> operators like * and // (integer division). The runtime cost is mostly
> dominated by the object-oriented overhead -- Python is not C or assembly,
> and the integers are rich objects, not low-level bitfields, so the
> difference between division and bitshifting is much less than you might
> expect from assembly language.
I don't suppose there's much of a chance that the OP is running Python
on a CPU that doesn't have an integer divide instruction? If that
_were_ the case, the difference would be more noticable, but would
still probably not worth worrying about unless a truely huge number of
operations were being done in a very tight loop with no intervening
I/O operations.
--
Grant Edwards grant.b.edwards Yow! I have accepted
at Provolone into my life!
gmail.com
--
http://mail.python.org/mailman/listinfo/python-list