Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28655

Re: Bitshifts and "And" vs Floor-division and Modular

Return-Path <jimmyli1528@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.028
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'binary': 0.05; 'defined.': 0.09; 'lawrence': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr :python-list': 0.10; 'wrote:': 0.17; 'module': 0.19; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'thursday,': 0.30; 'operations': 0.33; 'received:google.com': 0.34; 'faster': 0.35; 'received:209.85': 0.35; 'subject:" ': 0.36; 'bad': 0.37; 'why': 0.37; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'subject:-': 0.40; 'power': 0.74; 'subject:Floor': 0.84; 'yourself?': 0.84
Newsgroups comp.lang.python
Date Thu, 6 Sep 2012 18:05:41 -0700 (PDT)
In-Reply-To <mailman.336.1346977804.27098.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=2602:306:cd9e:2850:65c2:2987:4600:af4; posting-account=An6yGQoAAAD9ay8V5T7Wu52YyqyK-bYm
References <d8d77115-dcb2-4769-a592-5fca0fc264bc@googlegroups.com> <mailman.336.1346977804.27098.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 2602:306:cd9e:2850:65c2:2987:4600:af4
MIME-Version 1.0
Subject Re: Bitshifts and "And" vs Floor-division and Modular
From jimbo1qaz <jimmyli1528@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.337.1346979951.27098.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1346979951 news.xs4all.nl 6896 [2001:888:2000:d::a6]:47331
X-Complaints-To abuse@xs4all.nl
Path csiph.com!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!usenetcore.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Xref csiph.com comp.lang.python:28655

Show key headers only | View raw


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 style?
> 
> >
> 
> 
> 
> Why don't you use the timeit module and find out for yourself?
> 
> 
> 
> -- 
> 
> Cheers.
> 
> 
> 
> Mark Lawrence.

How do I use it? timeit.timer is not defined.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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