Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!multikabel.net!newsfeed20.multikabel.net!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'pep': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:Python3': 0.09; 'subject:set': 0.09; 'bitwise': 0.16; 'foul': 0.16; 'oct': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:bit': 0.16; 'think?': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'meant': 0.21; 'operations.': 0.22; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'header:X-Complaints-To:1': 0.28; 'chris': 0.28; 'clever': 0.29; "d'aprano": 0.29; 'steven': 0.29; 'no,': 0.29; 'fri,': 0.30; 'from:addr:yahoo.co.uk': 0.32; 'to:addr:python- list': 0.33; 'another': 0.33; 'faster': 0.35; 'pm,': 0.35; 'received:org': 0.36; 'skip:4 10': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'times': 0.63; 'six': 0.65; '26,': 0.65; '600': 0.71; 'rusi': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: bit count or bit set && Python3 Date: Thu, 25 Oct 2012 17:44:11 +0100 References: <5089511E.4090009@earthlink.net> <50896152$0$29978$c3e8da3$5496439d@news.astraweb.com> <41338e78-a3d9-4ab6-ab53-79ded90411c6@vy11g2000pbb.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-78-147-17-218.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 In-Reply-To: X-Antivirus: avast! (VPS 121025-1, 25/10/2012), Outbound message X-Antivirus-Status: Clean 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: , Newsgroups: comp.lang.python Message-ID: Lines: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351183324 news.xs4all.nl 6865 [2001:888:2000:d::a6]:58010 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32146 On 25/10/2012 17:29, Chris Angelico wrote: > On Fri, Oct 26, 2012 at 3:17 AM, rusi wrote: >> On Oct 25, 8:57 pm, Steven D'Aprano > +comp.lang.pyt...@pearwood.info> wrote: >>> py> min(t.repeat(number=10000, repeat=7)) >>> 0.6819710731506348 >>> py> min(t.repeat(number=100, repeat=7)) >>> 4.141788959503174 >>> >>> That makes the "inelegant" solution using bin() and count() about 600 >>> times faster than the mathematically clever solution using bitwise >>> operations. >> >> You meant 600% I think? > > It took six times longer to do one hundredth the iterations. > > ChrisA > Oh no, not another PEP 393 foul up :) -- Cheers. Mark Lawrence.