On 07/09/2012 02:08, Cameron Simpson wrote:
On 07Sep2012 01:30, Mark Lawrence breamore...@yahoo.co.uk wrote:
| On 07/09/2012 01:01, jimbo1qaz wrote:
| Is it faster to use bitshifts or floor division? And which is better, or
%?
| All divisors and mods are power of 2, so are binary operations
On 2012-09-07, Steven D'Aprano steve+comp.lang.pyt...@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,
On Sep 7, 9:32 am, Paul Rubin no.em...@nospam.invalid wrote:
rusi rustompm...@gmail.com writes:
On an 8086/8088 a MUL (multiply) instruction was of the order of 100
clocks ... On most modern processors (after the pentium) the
difference has mostly vanished. I cant find a good data sheet
On 09/07/2012 12:59 PM, rusi wrote:
On Sep 7, 9:32 am, Paul Rubin no.em...@nospam.invalid wrote:
rusi rustompm...@gmail.com writes:
On an 8086/8088 a MUL (multiply) instruction was of the order of 100
clocks ... On most modern processors (after the pentium) the
difference has mostly
Is it faster to use bitshifts or floor division? And which is better, or %?
All divisors and mods are power of 2, so are binary operations faster? And are
they considered bad style?
--
http://mail.python.org/mailman/listinfo/python-list
On 07/09/2012 01:01, jimbo1qaz wrote:
Is it faster to use bitshifts or floor division? And which is better, or %?
All divisors and mods are power of 2, so are binary operations faster? And are
they considered bad style?
Why don't you use the timeit module and find out for yourself?
--
On Thursday, September 6, 2012 5:30:05 PM UTC-7, Mark Lawrence wrote:
On 07/09/2012 01:01, jimbo1qaz wrote:
Is it faster to use bitshifts or floor division? And which is better, or
%?
All divisors and mods are power of 2, so are binary operations faster? And
are they considered bad
On 07Sep2012 01:30, Mark Lawrence breamore...@yahoo.co.uk wrote:
| On 07/09/2012 01:01, jimbo1qaz wrote:
| Is it faster to use bitshifts or floor division? And which is better, or
%?
| All divisors and mods are power of 2, so are binary operations faster? And
are they considered bad style?
|
On Thursday, September 6, 2012 5:01:12 PM UTC-7, jimbo1qaz wrote:
Is it faster to use bitshifts or floor division? And which is better, or %?
All divisors and mods are power of 2, so are binary operations faster? And
are they considered bad style?
OK, I decided to change my code. Which
On 09/06/2012 08:01 PM, jimbo1qaz wrote:
Is it faster to use bitshifts or floor division?
Yes, and yes. Without doing any measurement, I'd expect that in
CPython, it makes negligible performance difference for ordinary ints
(under 2**31, more or less). Ordinary ints can be done with single
On 09/06/2012 09:30 PM, jimbo1qaz wrote:
On Thursday, September 6, 2012 5:01:12 PM UTC-7, jimbo1qaz wrote:
Is it faster to use bitshifts or floor division? And which is better, or %?
All divisors and mods are power of 2, so are binary operations faster? And
are they considered bad style?
On 9/6/2012 8:01 PM, jimbo1qaz wrote:
Is it faster to use bitshifts or floor division? And which is better,
or %? All divisors and mods are power of 2, so are binary
operations faster? And are they considered bad style?
Yes, meaningless, yes, and no.
I would do what seems sensible to you in
On Thu, 06 Sep 2012 17:01:12 -0700, jimbo1qaz wrote:
Is it faster to use bitshifts or floor division?
Does it matter?
If you ever find yourself writing an application where the difference
between 0.0476 microseconds and 0.0473 microseconds matters to you,
Python is probably the wrong
On Thu, 06 Sep 2012 18:30:48 -0700, jimbo1qaz wrote:
OK, I decided to change my code. Which raises a similar question: Which
one is better for setting a bit of a byte: |= or +=, assuming each will
only be run once? Intuitively, I think |=
Python (like most languages) doesn't have a set this
On Sep 7, 5:01 am, jimbo1qaz jimmyli1...@gmail.com wrote:
Is it faster to use bitshifts or floor division? And which is better, or %?
All divisors and mods are power of 2, so are binary operations faster? And
are they considered bad style?
On an 8086/8088 a MUL (multiply) instruction was of
rusi rustompm...@gmail.com writes:
On an 8086/8088 a MUL (multiply) instruction was of the order of 100
clocks ... On most modern processors (after the pentium) the
difference has mostly vanished. I cant find a good data sheet to
quote though
See http://www.agner.org/optimize/ :
4.
16 matches
Mail list logo