On 09/07/2012 12:59 PM, rusi wrote:
> On Sep 7, 9:32 am, Paul Rubin wrote:
>> rusi 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 Sep 7, 9:32 am, Paul Rubin wrote:
> rusi 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.
On 2012-09-07, Steven D'Aprano 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,
On 07/09/2012 02:08, Cameron Simpson wrote:
On 07Sep2012 01:30, 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
rusi 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. Instruction tables: L
On Sep 7, 5:01 am, 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 an 8086/8088 a MUL (multiply) instruction was of the order of 100
c
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 thi
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 langua
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 t
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
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
inst
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 07Sep2012 01:30, 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 style?
|
| Why don't you use
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 con
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?
--
Chee
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
16 matches
Mail list logo