Return-Path: 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: 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: 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: 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 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.