Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28688
| From | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Bitshifts and "And" vs Floor-division and Modular |
| Date | 2012-09-07 14:19 +0000 |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Message-ID | <k2cvor$911$1@reader1.panix.com> (permalink) |
| References | <d8d77115-dcb2-4769-a592-5fca0fc264bc@googlegroups.com> <50495556$0$29981$c3e8da3$5496439d@news.astraweb.com> |
On 2012-09-07, Steven D'Aprano <steve+comp.lang.python@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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Bitshifts and "And" vs Floor-division and Modular jimbo1qaz <jimmyli1528@gmail.com> - 2012-09-06 17:01 -0700
Re: Bitshifts and "And" vs Floor-division and Modular Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-07 01:30 +0100
Re: Bitshifts and "And" vs Floor-division and Modular jimbo1qaz <jimmyli1528@gmail.com> - 2012-09-06 18:05 -0700
Re: Bitshifts and "And" vs Floor-division and Modular jimbo1qaz <jimmyli1528@gmail.com> - 2012-09-06 18:05 -0700
Re: Bitshifts and "And" vs Floor-division and Modular jimbo1qaz <jimmyli1528@gmail.com> - 2012-09-06 18:30 -0700
Re: Bitshifts and "And" vs Floor-division and Modular Dave Angel <d@davea.name> - 2012-09-06 21:46 -0400
Re: Bitshifts and "And" vs Floor-division and Modular Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-07 02:23 +0000
Re: Bitshifts and "And" vs Floor-division and Modular Dave Angel <d@davea.name> - 2012-09-06 21:36 -0400
Re: Bitshifts and "And" vs Floor-division and Modular Terry Reedy <tjreedy@udel.edu> - 2012-09-06 21:53 -0400
Re: Bitshifts and "And" vs Floor-division and Modular Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-07 02:00 +0000
Re: Bitshifts and "And" vs Floor-division and Modular Grant Edwards <invalid@invalid.invalid> - 2012-09-07 14:19 +0000
Re: Bitshifts and "And" vs Floor-division and Modular rusi <rustompmody@gmail.com> - 2012-09-06 20:38 -0700
Re: Bitshifts and "And" vs Floor-division and Modular Paul Rubin <no.email@nospam.invalid> - 2012-09-06 21:32 -0700
Re: Bitshifts and "And" vs Floor-division and Modular rusi <rustompmody@gmail.com> - 2012-09-07 09:59 -0700
Re: Bitshifts and "And" vs Floor-division and Modular Dave Angel <d@davea.name> - 2012-09-07 13:12 -0400
csiph-web