Bitshifts and "And" vs Floor-division and Modular
Grant Edwards
invalid at invalid.invalid
Fri Sep 7 10:19:07 EDT 2012
More information about the Python-list mailing list
Fri Sep 7 10:19:07 EDT 2012
- Previous message (by thread): Bitshifts and "And" vs Floor-division and Modular
- Next message (by thread): Bitshifts and "And" vs Floor-division and Modular
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2012-09-07, Steven D'Aprano <steve+comp.lang.python at pearwood.info> 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
- Previous message (by thread): Bitshifts and "And" vs Floor-division and Modular
- Next message (by thread): Bitshifts and "And" vs Floor-division and Modular
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list